sellmate-design-system-react 9.0.0-beta.18 → 9.0.0-beta.19
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/README.md +5 -0
- package/dist/components/SChipFilter/README.md +0 -2
- package/dist/components/SDraggableItem/README.md +1 -0
- package/dist/components/SDraggableItem/SDraggableItem.d.ts +2 -0
- package/dist/components/SDraggableList/README.md +5 -0
- package/dist/components/SDraggableList/SDraggableList.d.ts +10 -0
- package/dist/components/SDraggableList/index.d.ts +1 -1
- package/dist/index.cjs +148 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +148 -31
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +6 -1
- package/dist/styles.css +10 -0
- package/eslint/lib/table-column.mjs +12 -3
- package/eslint/rules/table-column-width.mjs +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -327,6 +327,11 @@ export default [
|
|
|
327
327
|
{ name: 'title', label: '상품명', field: 'title', autoWidth: true, render: r => r.title }
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
+
검사 대상은 `name`(문자열 리터럴) · `label` 에 더해 **`field` 또는 `autoWidth` 를 가진 객체**입니다.
|
|
331
|
+
검색 필터 필드나 상세 모달의 키-값 필드가 컬럼과 같은 `{ name, label, ... }` 모양이라, 그 둘만으로
|
|
332
|
+
판정하면 표와 무관한 객체가 대부분 걸리기 때문입니다. 대신 `{ ...base, name, label }` 처럼 `field` 가
|
|
333
|
+
스프레드로 들어오는 컬럼은 보고하지 않습니다 — 정적으로 필터 필드와 구분되지 않습니다.
|
|
334
|
+
|
|
330
335
|
예외는 컬럼 `name` 을 `allow` 로 지정해 뺍니다.
|
|
331
336
|
|
|
332
337
|
```js
|
|
@@ -331,7 +331,6 @@ export interface SChipFilterDatePreset {
|
|
|
331
331
|
- [SIcon](../SIcon)
|
|
332
332
|
- [SRadio](../SRadio)
|
|
333
333
|
- [SRadioButton](../SRadioButton)
|
|
334
|
-
- [SSelect](../SSelect)
|
|
335
334
|
- [STag](../STag)
|
|
336
335
|
- [STextLink](../STextLink)
|
|
337
336
|
- [STooltip](../STooltip)
|
|
@@ -346,7 +345,6 @@ graph TD;
|
|
|
346
345
|
SChipFilter --> SIcon
|
|
347
346
|
SChipFilter --> SRadio
|
|
348
347
|
SChipFilter --> SRadioButton
|
|
349
|
-
SChipFilter --> SSelect
|
|
350
348
|
SChipFilter --> STag
|
|
351
349
|
SChipFilter --> STextLink
|
|
352
350
|
SChipFilter --> STooltip
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| `supportingText?` | `SDraggableItemSlot` | — | 제목을 보조하는 텍스트 |
|
|
13
13
|
| `supportingTextPosition?` | `SDraggableItemSupportingTextPosition` | `'right'` | 보조 텍스트 위치 |
|
|
14
14
|
| `trailing?` | `SDraggableItemSlot` | — | 타이틀 뒤에 표시할 태그/콘텐츠 |
|
|
15
|
+
| `depth?` | `number` | `1` | 중첩 단계. `SListItem`·`SExpansionItem` 과 같은 들여쓰기 간격을 사용한다 |
|
|
15
16
|
| `accentStripe?` | `boolean` | `false` | 아이템 왼쪽 accent stripe 표시 여부 |
|
|
16
17
|
| `bordered?` | `boolean` | `false` | 외곽 테두리 사용 여부 |
|
|
17
18
|
| `selected?` | `boolean` | `false` | 선택 상태 여부 |
|
|
@@ -17,6 +17,8 @@ export interface SDraggableItemProps extends Omit<HTMLAttributes<HTMLDivElement>
|
|
|
17
17
|
supportingTextPosition?: SDraggableItemSupportingTextPosition;
|
|
18
18
|
/** 타이틀 뒤에 표시할 태그/콘텐츠 */
|
|
19
19
|
trailing?: SDraggableItemSlot;
|
|
20
|
+
/** 중첩 단계. `SListItem`·`SExpansionItem` 과 같은 들여쓰기 간격을 사용한다 */
|
|
21
|
+
depth?: number;
|
|
20
22
|
/** 아이템 왼쪽 accent stripe 표시 여부 */
|
|
21
23
|
accentStripe?: boolean;
|
|
22
24
|
/** 외곽 테두리 사용 여부 */
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
| `selectedKey?` | `string` | — | 외부에서 제어하는 selected 아이템 key |
|
|
29
29
|
| `defaultSelectedKey?` | `string` | — | 초기 selected 아이템 key |
|
|
30
30
|
| `getDisabled?` | `(item: T, index: number) => boolean` | — | disabled 아이템은 선택 및 드래그에서 제외 |
|
|
31
|
+
| `getDepth?` | `(item: T, index: number) => number` | — | 아이템의 중첩 단계. 기본값은 1 |
|
|
32
|
+
| `setDepth?` | `(item: T, depth: number) => T` | — | depth 변경이 필요한 드롭에서 다음 아이템을 만드는 함수 |
|
|
33
|
+
| `getCanHaveChildren?` | `(item: T, index: number) => boolean` | — | 하위 depth 를 가질 수 있는 아이템인지 판정 |
|
|
34
|
+
| `maxDepth?` | `number` | `3` | 허용할 최대 depth |
|
|
31
35
|
| `listId?` | `string` | — | Provider 안에서 사용할 리스트 식별자 |
|
|
32
36
|
| `group?` | `string` | — | 같은 group 값을 가진 리스트끼리 드래그 이벤트를 공유 |
|
|
33
37
|
|
|
@@ -67,6 +71,7 @@ export interface SDraggableGroupMoveEvent {
|
|
|
67
71
|
export interface SDraggableListRenderState {
|
|
68
72
|
onDragHandleMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
|
|
69
73
|
selected: boolean;
|
|
74
|
+
depth: number;
|
|
70
75
|
}
|
|
71
76
|
```
|
|
72
77
|
|
|
@@ -3,7 +3,9 @@ import { type SListProps } from '../SList';
|
|
|
3
3
|
export interface SDraggableListRenderState {
|
|
4
4
|
onDragHandleMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
|
|
5
5
|
selected: boolean;
|
|
6
|
+
depth: number;
|
|
6
7
|
}
|
|
8
|
+
export type SDraggableListDropIntent = 'before' | 'inside' | 'after';
|
|
7
9
|
export interface SDraggableListProps<T> extends Omit<SListProps, 'children' | 'onChange'> {
|
|
8
10
|
/** 현재 순서대로 렌더링할 아이템 목록 */
|
|
9
11
|
items: T[];
|
|
@@ -21,6 +23,14 @@ export interface SDraggableListProps<T> extends Omit<SListProps, 'children' | 'o
|
|
|
21
23
|
onSelectedKeyChange?: (key: string) => void;
|
|
22
24
|
/** disabled 아이템은 선택 및 드래그에서 제외 */
|
|
23
25
|
getDisabled?: (item: T, index: number) => boolean;
|
|
26
|
+
/** 아이템의 중첩 단계. 기본값은 1 */
|
|
27
|
+
getDepth?: (item: T, index: number) => number;
|
|
28
|
+
/** depth 변경이 필요한 드롭에서 다음 아이템을 만드는 함수 */
|
|
29
|
+
setDepth?: (item: T, depth: number) => T;
|
|
30
|
+
/** 하위 depth 를 가질 수 있는 아이템인지 판정 */
|
|
31
|
+
getCanHaveChildren?: (item: T, index: number) => boolean;
|
|
32
|
+
/** 허용할 최대 depth */
|
|
33
|
+
maxDepth?: number;
|
|
24
34
|
/** Provider 안에서 사용할 리스트 식별자 */
|
|
25
35
|
listId?: string;
|
|
26
36
|
/** 같은 group 값을 가진 리스트끼리 드래그 이벤트를 공유 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SDraggableList, type SDraggableListProps, type SDraggableListRenderState, } from './SDraggableList';
|
|
1
|
+
export { SDraggableList, type SDraggableListDropIntent, type SDraggableListProps, type SDraggableListRenderState, } from './SDraggableList';
|
|
2
2
|
export { SDraggableProvider, SDraggableGroup, type SDraggableGroupMoveEvent, type SDraggableGroupProps, type SDraggableProviderProps, } from './SDraggableGroup';
|
package/dist/index.cjs
CHANGED
|
@@ -3491,6 +3491,7 @@ var SDraggableItemView = /* @__PURE__ */ react.forwardRef(
|
|
|
3491
3491
|
supportingText,
|
|
3492
3492
|
supportingTextPosition,
|
|
3493
3493
|
trailing,
|
|
3494
|
+
depth,
|
|
3494
3495
|
accentStripe,
|
|
3495
3496
|
bordered,
|
|
3496
3497
|
selected,
|
|
@@ -3502,6 +3503,7 @@ var SDraggableItemView = /* @__PURE__ */ react.forwardRef(
|
|
|
3502
3503
|
dragHandleProps,
|
|
3503
3504
|
onDragHandleMouseDown,
|
|
3504
3505
|
className,
|
|
3506
|
+
style,
|
|
3505
3507
|
...rest
|
|
3506
3508
|
}, ref) {
|
|
3507
3509
|
const renderState = { hovered, dragging, disabled };
|
|
@@ -3511,12 +3513,19 @@ var SDraggableItemView = /* @__PURE__ */ react.forwardRef(
|
|
|
3511
3513
|
const trailingNode = renderSlot(trailing, renderState);
|
|
3512
3514
|
const titleTypo = size === "sm" ? selected ? "typo-item-sm-selected" : "typo-item-sm-default" : selected ? "typo-item-md-selected" : "typo-item-md-default";
|
|
3513
3515
|
const paddingYClass = dense ? size === "sm" ? "py-(--cmp-listDraggableItem-paddingY-sm-dense)" : "py-(--cmp-listDraggableItem-paddingY-md-dense)" : size === "sm" ? "py-(--cmp-listDraggableItem-paddingY-sm-normal)" : "py-(--cmp-listDraggableItem-paddingY-md-normal)";
|
|
3516
|
+
const normalizedDepth = Math.max(1, Math.floor(depth));
|
|
3517
|
+
const depthOffset = (normalizedDepth - 1) * 20;
|
|
3518
|
+
const depthStyle = depthOffset === 0 ? style : {
|
|
3519
|
+
...style,
|
|
3520
|
+
paddingLeft: `calc(var(--cmp-listDraggableItem-paddingX) + ${depthOffset}px)`
|
|
3521
|
+
};
|
|
3514
3522
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3515
3523
|
"div",
|
|
3516
3524
|
{
|
|
3517
3525
|
ref,
|
|
3518
3526
|
"aria-disabled": disabled || void 0,
|
|
3519
3527
|
"data-dragging": dragging || void 0,
|
|
3528
|
+
style: depthStyle,
|
|
3520
3529
|
className: cn(
|
|
3521
3530
|
"relative flex w-full items-center gap-(--cmp-listDraggableItem-gap) overflow-hidden px-(--cmp-listDraggableItem-paddingX)",
|
|
3522
3531
|
titleTypo,
|
|
@@ -3605,6 +3614,7 @@ var SDraggableItemImpl = /* @__PURE__ */ react.forwardRef(function SDraggableIte
|
|
|
3605
3614
|
supportingText,
|
|
3606
3615
|
supportingTextPosition = "right",
|
|
3607
3616
|
trailing,
|
|
3617
|
+
depth = 1,
|
|
3608
3618
|
accentStripe = false,
|
|
3609
3619
|
bordered = false,
|
|
3610
3620
|
selected = false,
|
|
@@ -3678,6 +3688,7 @@ var SDraggableItemImpl = /* @__PURE__ */ react.forwardRef(function SDraggableIte
|
|
|
3678
3688
|
supportingText,
|
|
3679
3689
|
supportingTextPosition,
|
|
3680
3690
|
trailing,
|
|
3691
|
+
depth,
|
|
3681
3692
|
accentStripe,
|
|
3682
3693
|
bordered,
|
|
3683
3694
|
selected,
|
|
@@ -3713,6 +3724,7 @@ var SDraggableItemImpl = /* @__PURE__ */ react.forwardRef(function SDraggableIte
|
|
|
3713
3724
|
supportingText,
|
|
3714
3725
|
supportingTextPosition,
|
|
3715
3726
|
trailing,
|
|
3727
|
+
depth,
|
|
3716
3728
|
accentStripe,
|
|
3717
3729
|
bordered,
|
|
3718
3730
|
selected,
|
|
@@ -3962,6 +3974,42 @@ function reorder(items, fromIndex, toIndex) {
|
|
|
3962
3974
|
nextItems.splice(toIndex, 0, movedItem);
|
|
3963
3975
|
return nextItems;
|
|
3964
3976
|
}
|
|
3977
|
+
function clampDepth(depth, maxDepth) {
|
|
3978
|
+
return Math.max(1, Math.min(maxDepth, Math.floor(depth)));
|
|
3979
|
+
}
|
|
3980
|
+
function getSubtreeEnd(items, startIndex, getDepth) {
|
|
3981
|
+
const startDepth = getDepth(items[startIndex], startIndex);
|
|
3982
|
+
let endIndex = startIndex + 1;
|
|
3983
|
+
while (endIndex < items.length && getDepth(items[endIndex], endIndex) > startDepth) {
|
|
3984
|
+
endIndex += 1;
|
|
3985
|
+
}
|
|
3986
|
+
return endIndex;
|
|
3987
|
+
}
|
|
3988
|
+
function getInsertionIndex(items, target, getDepth) {
|
|
3989
|
+
if (target.intent === "before") return target.index;
|
|
3990
|
+
if (target.intent === "inside") return target.index + 1;
|
|
3991
|
+
return getSubtreeEnd(items, target.index, getDepth);
|
|
3992
|
+
}
|
|
3993
|
+
function moveWithDepth(items, fromIndex, target, getDepth, setDepth, maxDepth) {
|
|
3994
|
+
const fromEndIndex = getSubtreeEnd(items, fromIndex, getDepth);
|
|
3995
|
+
if (target.index >= fromIndex && target.index < fromEndIndex) return items;
|
|
3996
|
+
const movedItems = items.slice(fromIndex, fromEndIndex);
|
|
3997
|
+
const remainingItems = [...items.slice(0, fromIndex), ...items.slice(fromEndIndex)];
|
|
3998
|
+
const rawInsertionIndex = getInsertionIndex(items, target, getDepth);
|
|
3999
|
+
const insertionIndex = rawInsertionIndex > fromIndex ? rawInsertionIndex - movedItems.length : rawInsertionIndex;
|
|
4000
|
+
const sourceDepth = getDepth(items[fromIndex], fromIndex);
|
|
4001
|
+
const targetDepth = getDepth(items[target.index], target.index);
|
|
4002
|
+
const nextDepth = target.intent === "inside" ? targetDepth + 1 : targetDepth;
|
|
4003
|
+
const depthDelta = clampDepth(nextDepth, maxDepth) - sourceDepth;
|
|
4004
|
+
const nextMovedItems = setDepth && depthDelta !== 0 ? movedItems.map(
|
|
4005
|
+
(item, index) => setDepth(item, clampDepth(getDepth(item, fromIndex + index) + depthDelta, maxDepth))
|
|
4006
|
+
) : movedItems;
|
|
4007
|
+
return [
|
|
4008
|
+
...remainingItems.slice(0, insertionIndex),
|
|
4009
|
+
...nextMovedItems,
|
|
4010
|
+
...remainingItems.slice(insertionIndex)
|
|
4011
|
+
];
|
|
4012
|
+
}
|
|
3965
4013
|
function SDraggableListInner({
|
|
3966
4014
|
items,
|
|
3967
4015
|
getKey,
|
|
@@ -3971,6 +4019,10 @@ function SDraggableListInner({
|
|
|
3971
4019
|
defaultSelectedKey,
|
|
3972
4020
|
onSelectedKeyChange,
|
|
3973
4021
|
getDisabled,
|
|
4022
|
+
getDepth,
|
|
4023
|
+
setDepth,
|
|
4024
|
+
getCanHaveChildren,
|
|
4025
|
+
maxDepth = 3,
|
|
3974
4026
|
listId,
|
|
3975
4027
|
group: groupName,
|
|
3976
4028
|
useGap,
|
|
@@ -3980,19 +4032,24 @@ function SDraggableListInner({
|
|
|
3980
4032
|
const dragContext = useSDraggableGroup();
|
|
3981
4033
|
const dragGroup = groupName ?? dragContext?.defaultGroup;
|
|
3982
4034
|
const [draggingIndex, setDraggingIndex] = react.useState(null);
|
|
3983
|
-
const [
|
|
4035
|
+
const [dropTarget, setDropTarget] = react.useState(null);
|
|
3984
4036
|
const [internalSelectedKey, setInternalSelectedKey] = react.useState(
|
|
3985
4037
|
defaultSelectedKey
|
|
3986
4038
|
);
|
|
3987
4039
|
const listRef = react.useRef(null);
|
|
3988
4040
|
const fromIndexRef = react.useRef(null);
|
|
3989
4041
|
const currentSelectedKey = selectedKey ?? internalSelectedKey;
|
|
4042
|
+
const usesDepth = getDepth != null;
|
|
3990
4043
|
const startDrag = react.useCallback((event, index) => {
|
|
3991
4044
|
event.preventDefault();
|
|
3992
4045
|
fromIndexRef.current = index;
|
|
3993
4046
|
setDraggingIndex(index);
|
|
3994
|
-
|
|
4047
|
+
setDropTarget({ index, intent: "before" });
|
|
3995
4048
|
}, []);
|
|
4049
|
+
const readDepth = react.useCallback(
|
|
4050
|
+
(item, index) => clampDepth(getDepth?.(item, index) ?? 1, maxDepth),
|
|
4051
|
+
[getDepth, maxDepth]
|
|
4052
|
+
);
|
|
3996
4053
|
react.useEffect(() => {
|
|
3997
4054
|
if (dragContext || draggingIndex == null) return void 0;
|
|
3998
4055
|
const handleMouseMove = (event) => {
|
|
@@ -4000,25 +4057,65 @@ function SDraggableListInner({
|
|
|
4000
4057
|
"[data-draggable-list-item]"
|
|
4001
4058
|
);
|
|
4002
4059
|
if (!itemElements) return;
|
|
4003
|
-
let
|
|
4004
|
-
|
|
4060
|
+
let nextDropTarget = items.length === 0 ? { index: 0, intent: "before" } : { index: items.length - 1, intent: "after" };
|
|
4061
|
+
const draggingEndIndex = usesDepth && draggingIndex != null ? getSubtreeEnd(items, draggingIndex, readDepth) : draggingIndex + 1;
|
|
4062
|
+
let previousDropIndex = null;
|
|
4063
|
+
for (let index = 0; index < itemElements.length; index += 1) {
|
|
4064
|
+
const itemElement = itemElements[index];
|
|
4005
4065
|
const rect = itemElement.getBoundingClientRect();
|
|
4006
|
-
if (
|
|
4007
|
-
|
|
4066
|
+
if (index >= draggingIndex && index < draggingEndIndex) {
|
|
4067
|
+
if (event.clientY <= rect.bottom) {
|
|
4068
|
+
if (previousDropIndex != null) {
|
|
4069
|
+
nextDropTarget = { index: previousDropIndex, intent: "after" };
|
|
4070
|
+
} else {
|
|
4071
|
+
nextDropTarget = { index: draggingIndex, intent: "before" };
|
|
4072
|
+
}
|
|
4073
|
+
break;
|
|
4074
|
+
}
|
|
4075
|
+
continue;
|
|
4008
4076
|
}
|
|
4009
|
-
|
|
4010
|
-
|
|
4077
|
+
if (event.clientY < rect.top) {
|
|
4078
|
+
nextDropTarget = { index, intent: "before" };
|
|
4079
|
+
break;
|
|
4080
|
+
}
|
|
4081
|
+
if (event.clientY > rect.bottom) {
|
|
4082
|
+
previousDropIndex = index;
|
|
4083
|
+
nextDropTarget = { index, intent: "after" };
|
|
4084
|
+
continue;
|
|
4085
|
+
}
|
|
4086
|
+
const ratio = (event.clientY - rect.top) / rect.height;
|
|
4087
|
+
if (!usesDepth) {
|
|
4088
|
+
nextDropTarget = ratio < 0.5 ? { index, intent: "before" } : { index, intent: "after" };
|
|
4089
|
+
break;
|
|
4090
|
+
}
|
|
4091
|
+
const item = items[index];
|
|
4092
|
+
const canHaveChildren = (getCanHaveChildren?.(item, index) ?? true) && readDepth(item, index) < maxDepth;
|
|
4093
|
+
if (ratio < 0.25) {
|
|
4094
|
+
nextDropTarget = { index, intent: "before" };
|
|
4095
|
+
} else if (ratio > 0.75 || !canHaveChildren) {
|
|
4096
|
+
nextDropTarget = { index, intent: "after" };
|
|
4097
|
+
} else {
|
|
4098
|
+
nextDropTarget = { index, intent: "inside" };
|
|
4099
|
+
}
|
|
4100
|
+
break;
|
|
4101
|
+
}
|
|
4102
|
+
setDropTarget(nextDropTarget);
|
|
4011
4103
|
};
|
|
4012
4104
|
const handleMouseUp = () => {
|
|
4013
4105
|
const fromIndex = fromIndexRef.current;
|
|
4014
|
-
const
|
|
4015
|
-
if (fromIndex != null &&
|
|
4016
|
-
const
|
|
4017
|
-
|
|
4106
|
+
const nextDropTarget = dropTarget;
|
|
4107
|
+
if (fromIndex != null && nextDropTarget != null && items[nextDropTarget.index]) {
|
|
4108
|
+
const insertionIndex = getInsertionIndex(items, nextDropTarget, () => 1);
|
|
4109
|
+
const nextItems = usesDepth ? moveWithDepth(items, fromIndex, nextDropTarget, readDepth, setDepth, maxDepth) : reorder(
|
|
4110
|
+
items,
|
|
4111
|
+
fromIndex,
|
|
4112
|
+
insertionIndex > fromIndex ? insertionIndex - 1 : insertionIndex
|
|
4113
|
+
);
|
|
4114
|
+
if (nextItems !== items) onChange?.(nextItems);
|
|
4018
4115
|
}
|
|
4019
4116
|
fromIndexRef.current = null;
|
|
4020
4117
|
setDraggingIndex(null);
|
|
4021
|
-
|
|
4118
|
+
setDropTarget(null);
|
|
4022
4119
|
};
|
|
4023
4120
|
window.addEventListener("mousemove", handleMouseMove);
|
|
4024
4121
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -4026,12 +4123,25 @@ function SDraggableListInner({
|
|
|
4026
4123
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
4027
4124
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
4028
4125
|
};
|
|
4029
|
-
}, [
|
|
4126
|
+
}, [
|
|
4127
|
+
draggingIndex,
|
|
4128
|
+
dropTarget,
|
|
4129
|
+
items,
|
|
4130
|
+
onChange,
|
|
4131
|
+
dragContext,
|
|
4132
|
+
getDepth,
|
|
4133
|
+
usesDepth,
|
|
4134
|
+
readDepth,
|
|
4135
|
+
setDepth,
|
|
4136
|
+
maxDepth,
|
|
4137
|
+
getCanHaveChildren
|
|
4138
|
+
]);
|
|
4030
4139
|
if (dragContext && (!listId || !dragGroup)) {
|
|
4031
4140
|
throw new Error("SDraggableList: Provider \uC548\uC5D0\uC11C\uB294 group\uACFC listId\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.");
|
|
4032
4141
|
}
|
|
4033
4142
|
const groupDrop = dragContext?.drop;
|
|
4034
|
-
const currentDropIndex = dragContext ? groupDrop?.group === dragGroup && groupDrop?.listId === listId ? groupDrop?.index ?? null : null :
|
|
4143
|
+
const currentDropIndex = dragContext ? groupDrop?.group === dragGroup && groupDrop?.listId === listId ? groupDrop?.index ?? null : null : dropTarget?.index;
|
|
4144
|
+
const currentDropIntent = dragContext ? void 0 : dropTarget?.intent;
|
|
4035
4145
|
const isDropTarget = dragContext ? groupDrop?.group === dragGroup && groupDrop?.listId === listId : draggingIndex != null;
|
|
4036
4146
|
const showEmptyDrop = Boolean(dragContext && isDropTarget && items.length === 0);
|
|
4037
4147
|
const beforeIndicatorPosition = useGap ? "before:top-[-5px]" : "before:top-0";
|
|
@@ -4062,19 +4172,30 @@ function SDraggableListInner({
|
|
|
4062
4172
|
children: items.map((item, index) => {
|
|
4063
4173
|
const itemKey = getKey(item, index);
|
|
4064
4174
|
const disabled = getDisabled?.(item, index) ?? false;
|
|
4065
|
-
const
|
|
4066
|
-
const
|
|
4175
|
+
const depth = readDepth(item, index);
|
|
4176
|
+
const showBefore = isDropTarget && currentDropIndex === index && (dragContext || currentDropIntent === "before");
|
|
4177
|
+
const showInside = isDropTarget && currentDropIndex === index && !dragContext && usesDepth && currentDropIntent === "inside";
|
|
4178
|
+
const showAfter = isDropTarget && (dragContext ? currentDropIndex === items.length && index === items.length - 1 : currentDropIndex === index && currentDropIntent === "after");
|
|
4179
|
+
const selectItem = () => {
|
|
4180
|
+
if (disabled) return;
|
|
4181
|
+
setInternalSelectedKey(itemKey);
|
|
4182
|
+
onSelectedKeyChange?.(itemKey);
|
|
4183
|
+
};
|
|
4184
|
+
const handleItemKeyDown = (event) => {
|
|
4185
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
4186
|
+
event.preventDefault();
|
|
4187
|
+
selectItem();
|
|
4188
|
+
};
|
|
4067
4189
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4068
4190
|
"div",
|
|
4069
4191
|
{
|
|
4070
4192
|
"data-draggable-list-item": true,
|
|
4193
|
+
role: "button",
|
|
4194
|
+
tabIndex: disabled ? -1 : 0,
|
|
4071
4195
|
"aria-disabled": disabled || void 0,
|
|
4072
|
-
onClick:
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
onSelectedKeyChange?.(itemKey);
|
|
4076
|
-
},
|
|
4077
|
-
className: `relative ${showBefore ? `before:absolute before:left-0 before:right-0 ${beforeIndicatorPosition} before:z-10 before:h-[2px] before:bg-(--sys-color-border-accent) before:content-['']` : ""} ${showAfter ? `after:absolute after:left-0 after:right-0 ${afterIndicatorPosition} after:z-10 after:h-[2px] after:bg-(--sys-color-border-accent) after:content-['']` : ""}`,
|
|
4196
|
+
onClick: selectItem,
|
|
4197
|
+
onKeyDown: handleItemKeyDown,
|
|
4198
|
+
className: `relative ${showBefore ? `before:absolute before:left-0 before:right-0 ${beforeIndicatorPosition} before:z-10 before:h-[2px] before:bg-(--sys-color-border-accent) before:content-['']` : ""} ${showAfter ? `after:absolute after:left-0 after:right-0 ${afterIndicatorPosition} after:z-10 after:h-[2px] after:bg-(--sys-color-border-accent) after:content-['']` : ""} ${showInside ? "outline outline-2 outline-offset-[-2px] outline-(--sys-color-border-accent)" : ""}`,
|
|
4078
4199
|
children: renderItem(item, index, {
|
|
4079
4200
|
onDragHandleMouseDown: (event) => {
|
|
4080
4201
|
if (disabled) return;
|
|
@@ -4082,7 +4203,8 @@ function SDraggableListInner({
|
|
|
4082
4203
|
dragContext.startDrag(event, dragGroup, listId, index, itemKey);
|
|
4083
4204
|
} else startDrag(event, index);
|
|
4084
4205
|
},
|
|
4085
|
-
selected: currentSelectedKey === itemKey
|
|
4206
|
+
selected: currentSelectedKey === itemKey,
|
|
4207
|
+
depth
|
|
4086
4208
|
})
|
|
4087
4209
|
},
|
|
4088
4210
|
itemKey
|
|
@@ -15930,13 +16052,11 @@ function PeriodPresetEditor({
|
|
|
15930
16052
|
}
|
|
15931
16053
|
if (selectedUnit === "quarter") {
|
|
15932
16054
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15933
|
-
|
|
16055
|
+
SRadioButton,
|
|
15934
16056
|
{
|
|
15935
16057
|
value: typeof periodValue.value === "number" ? periodValue.value : 1,
|
|
15936
16058
|
onValueChange: updateInputValue,
|
|
15937
|
-
emitValue: true,
|
|
15938
16059
|
disabled,
|
|
15939
|
-
width: "100%",
|
|
15940
16060
|
options: [
|
|
15941
16061
|
{ value: 1, label: "1\uBD84\uAE30" },
|
|
15942
16062
|
{ value: 2, label: "2\uBD84\uAE30" },
|
|
@@ -15948,13 +16068,11 @@ function PeriodPresetEditor({
|
|
|
15948
16068
|
}
|
|
15949
16069
|
if (selectedUnit === "half") {
|
|
15950
16070
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15951
|
-
|
|
16071
|
+
SRadioButton,
|
|
15952
16072
|
{
|
|
15953
16073
|
value: typeof periodValue.value === "string" ? periodValue.value : "first",
|
|
15954
16074
|
onValueChange: updateInputValue,
|
|
15955
|
-
emitValue: true,
|
|
15956
16075
|
disabled,
|
|
15957
|
-
width: "100%",
|
|
15958
16076
|
options: [
|
|
15959
16077
|
{ value: "first", label: "\uC0C1\uBC18\uAE30" },
|
|
15960
16078
|
{ value: "second", label: "\uD558\uBC18\uAE30" }
|
|
@@ -16000,7 +16118,6 @@ function PeriodPresetEditor({
|
|
|
16000
16118
|
},
|
|
16001
16119
|
preset.value
|
|
16002
16120
|
)) }),
|
|
16003
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": true, className: "h-px w-full", style: { background: CHIPFILTER.listboxBorder } }),
|
|
16004
16121
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full [&>*]:w-full", children: renderInput() })
|
|
16005
16122
|
] });
|
|
16006
16123
|
}
|