pds-dev-kit-web-test 0.3.54 → 0.3.56
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/src/common/assets/icons/fill/Sales.js +1 -1
- package/dist/src/common/assets/icons/fill/Shoppingbag.js +1 -1
- package/dist/src/common/assets/icons/fill/StarShaped.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/StarShaped.js +30 -0
- package/dist/src/common/assets/icons/fill/Target.js +1 -1
- package/dist/src/common/assets/icons/fill/Xmark.d.ts +4 -0
- package/dist/src/common/assets/icons/fill/Xmark.js +30 -0
- package/dist/src/common/assets/icons/fill/index.d.ts +2 -0
- package/dist/src/common/assets/icons/fill/index.js +5 -1
- package/dist/src/common/assets/icons/line/StarShaped.d.ts +4 -0
- package/dist/src/common/assets/icons/line/StarShaped.js +30 -0
- package/dist/src/common/assets/icons/line/Ticket.d.ts +4 -0
- package/dist/src/common/assets/icons/line/Ticket.js +30 -0
- package/dist/src/common/assets/icons/line/index.d.ts +2 -0
- package/dist/src/common/assets/icons/line/index.js +4 -0
- package/dist/src/common/hooks/index.d.ts +0 -1
- package/dist/src/common/hooks/index.js +1 -5
- package/dist/src/common/styles/colorSet/UIColor.json +2 -1
- package/dist/src/common/styles/colorSet/index.d.ts +1 -0
- package/dist/src/common/styles/colorSet/ui-type.d.ts +1 -0
- package/dist/src/common/types/components.d.ts +1 -0
- package/dist/src/desktop/components/ContextMenuItem/ContextMenuItem.js +17 -5
- package/dist/src/desktop/components/DesktopAlertDialog/DesktopAlertDialog.js +13 -8
- package/dist/src/desktop/components/DesktopHeaderBar/DesktopHeaderBar.js +1 -1
- package/dist/src/desktop/panels/DesktopTutorialModal/DesktopTutorialModal.d.ts +2 -1
- package/dist/src/desktop/panels/DesktopTutorialModal/DesktopTutorialModal.js +20 -9
- package/dist/src/mobile/components/ContextMenuItem/ContextMenuItem.js +15 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +19 -2
- package/package.json +1 -1
- package/release-note.md +5 -5
- package/dist/src/common/hooks/useShortcutKey/ShortcutKeyProvider.d.ts +0 -27
- package/dist/src/common/hooks/useShortcutKey/ShortcutKeyProvider.js +0 -74
- package/dist/src/common/hooks/useShortcutKey/constants.d.ts +0 -2
- package/dist/src/common/hooks/useShortcutKey/constants.js +0 -25
- package/dist/src/common/hooks/useShortcutKey/index.d.ts +0 -3
- package/dist/src/common/hooks/useShortcutKey/index.js +0 -8
- package/dist/src/common/hooks/useShortcutKey/types.d.ts +0 -27
- package/dist/src/common/hooks/useShortcutKey/types.js +0 -2
- package/dist/src/common/hooks/useShortcutKey/useShortcutKey.d.ts +0 -3
- package/dist/src/common/hooks/useShortcutKey/useShortcutKey.js +0 -62
- package/dist/src/common/hooks/useShortcutKey/validators.d.ts +0 -20
- package/dist/src/common/hooks/useShortcutKey/validators.js +0 -150
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useShortcutKey = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var ShortcutKeyProvider_1 = require("./ShortcutKeyProvider");
|
|
6
|
-
var validators_1 = require("./validators");
|
|
7
|
-
/**
|
|
8
|
-
* @param targetKeys 사용할 단축키
|
|
9
|
-
* @param callback 단축키를 눌렀을 때 실행시킬 콜백 함수
|
|
10
|
-
* @param deps 단축키가 실행될 때 호출되는 콜백 함수와 관련된 의존성으로 변경될 때마다 단축키 관련 동작을 다시 설정하도록 하기
|
|
11
|
-
* @param options disabled 단축키 비활성화 여부, scopes 해당 단축키 사용 범위 설정
|
|
12
|
-
* @example
|
|
13
|
-
* useKeyboardShortcut('ctrl+d, meta+d', handleDuplicate, [id]);
|
|
14
|
-
* useKeyboardShortcut('delete, backspace', handleDelete, [id], { disabled: true });
|
|
15
|
-
*/
|
|
16
|
-
var useSafeLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
17
|
-
function useShortcutKey(targetKeys, callback, options, deps) {
|
|
18
|
-
var cbRef = (0, react_1.useRef)(callback);
|
|
19
|
-
var memoisedCB = (0, react_1.useCallback)(callback, deps !== null && deps !== void 0 ? deps : []);
|
|
20
|
-
if (deps) {
|
|
21
|
-
cbRef.current = memoisedCB;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
cbRef.current = callback;
|
|
25
|
-
}
|
|
26
|
-
var enabledScopes = (0, ShortcutKeyProvider_1.useShortcutKeyContext)().enabledScopes;
|
|
27
|
-
useSafeLayoutEffect(function () {
|
|
28
|
-
if ((options === null || options === void 0 ? void 0 : options.disabled) === false || !(0, validators_1.isScopeActive)(enabledScopes, options === null || options === void 0 ? void 0 : options.scopes))
|
|
29
|
-
return;
|
|
30
|
-
var listener = function (e) {
|
|
31
|
-
if ((0, validators_1.isKeyboardEventTriggeredByInput)(e) &&
|
|
32
|
-
!(0, validators_1.isShortcutkeyEnabledOnTag)(e, options === null || options === void 0 ? void 0 : options.enableOnFormTags)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
(0, validators_1.parseMultipleShortcutKeys)(targetKeys).forEach(function (key) {
|
|
36
|
-
var keys = (0, validators_1.parseKey)(key);
|
|
37
|
-
if ((0, validators_1.isKeyMatchingKeyboardEvent)(e, keys)) {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
cbRef.current(e, keys);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
var handleKeyPress = function (e) {
|
|
44
|
-
if (e.key === undefined || e.repeat)
|
|
45
|
-
return;
|
|
46
|
-
(0, validators_1.pushToCurrentlyPressedKeys)((0, validators_1.mapKey)(e.code));
|
|
47
|
-
listener(e);
|
|
48
|
-
};
|
|
49
|
-
var handleKeyUp = function (e) {
|
|
50
|
-
if (e.key === undefined)
|
|
51
|
-
return;
|
|
52
|
-
(0, validators_1.removeFromCurrentlyPressedKeys)((0, validators_1.mapKey)(e.code));
|
|
53
|
-
};
|
|
54
|
-
document.addEventListener('keydown', handleKeyPress);
|
|
55
|
-
document.addEventListener('keyup', handleKeyUp);
|
|
56
|
-
return function () {
|
|
57
|
-
document.removeEventListener('keydown', handleKeyPress);
|
|
58
|
-
document.removeEventListener('keyup', handleKeyUp);
|
|
59
|
-
};
|
|
60
|
-
}, [targetKeys, options, enabledScopes]);
|
|
61
|
-
}
|
|
62
|
-
exports.useShortcutKey = useShortcutKey;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { FormTags, KeysEvent, Scopes } from './types';
|
|
2
|
-
export declare function mapKey(key: string): string;
|
|
3
|
-
export declare function parseKey(shortcutKey: string, combinationKey?: string): {
|
|
4
|
-
keys: string[];
|
|
5
|
-
alt?: boolean | undefined;
|
|
6
|
-
ctrl?: boolean | undefined;
|
|
7
|
-
meta?: boolean | undefined;
|
|
8
|
-
shift?: boolean | undefined;
|
|
9
|
-
mod?: boolean | undefined;
|
|
10
|
-
};
|
|
11
|
-
export declare function parseMultipleShortcutKeys(keys: string, splitKey?: string): string[];
|
|
12
|
-
export declare function isKeyMatchingKeyboardEvent(e: KeyboardEvent, key: KeysEvent): boolean;
|
|
13
|
-
export declare function isReadonlyArray(value: unknown): value is readonly unknown[];
|
|
14
|
-
export declare function isKeyPressed(shortcutKey: string | readonly string[], splitKey?: string): boolean;
|
|
15
|
-
export declare function isKeyModifier(key: string): boolean;
|
|
16
|
-
export declare function pushToCurrentlyPressedKeys(key: string | string[]): void;
|
|
17
|
-
export declare function removeFromCurrentlyPressedKeys(key: string | string[]): void;
|
|
18
|
-
export declare function isScopeActive(activeScopes: string[], scopes?: Scopes): boolean;
|
|
19
|
-
export declare function isKeyboardEventTriggeredByInput(e: KeyboardEvent): boolean;
|
|
20
|
-
export declare function isShortcutkeyEnabledOnTag({ target }: KeyboardEvent, enabledOnTags?: readonly FormTags[] | boolean): boolean;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.isShortcutkeyEnabledOnTag = exports.isKeyboardEventTriggeredByInput = exports.isScopeActive = exports.removeFromCurrentlyPressedKeys = exports.pushToCurrentlyPressedKeys = exports.isKeyModifier = exports.isKeyPressed = exports.isReadonlyArray = exports.isKeyMatchingKeyboardEvent = exports.parseMultipleShortcutKeys = exports.parseKey = exports.mapKey = void 0;
|
|
15
|
-
var constants_1 = require("./constants");
|
|
16
|
-
// NOTE - keydown된 key를 원하는 형태로 mapping해주는 함수입니다.
|
|
17
|
-
function mapKey(key) {
|
|
18
|
-
return (constants_1.mappedKeys[key] || key)
|
|
19
|
-
.trim()
|
|
20
|
-
.toLocaleLowerCase()
|
|
21
|
-
.replace(/key|digit|numpad|arrow/, '');
|
|
22
|
-
}
|
|
23
|
-
exports.mapKey = mapKey;
|
|
24
|
-
// NOTE - 단축키로 등록한 keys들을 key의 단위로 분리하여 parse해주는 함수입니다.
|
|
25
|
-
function parseKey(shortcutKey, combinationKey) {
|
|
26
|
-
if (combinationKey === void 0) { combinationKey = '+'; }
|
|
27
|
-
var keys = shortcutKey
|
|
28
|
-
.toLocaleLowerCase()
|
|
29
|
-
.split(combinationKey)
|
|
30
|
-
.map(function (k) { return mapKey(k); });
|
|
31
|
-
var modifiers = {
|
|
32
|
-
alt: keys.includes('alt'),
|
|
33
|
-
ctrl: keys.includes('ctrl') || keys.includes('control'),
|
|
34
|
-
shift: keys.includes('shift'),
|
|
35
|
-
meta: keys.includes('meta'),
|
|
36
|
-
mod: keys.includes('mod')
|
|
37
|
-
};
|
|
38
|
-
var singleCharKeys = keys.filter(function (k) { return !constants_1.reservedModifierKeywords.includes(k); });
|
|
39
|
-
return __assign(__assign({}, modifiers), { keys: singleCharKeys });
|
|
40
|
-
}
|
|
41
|
-
exports.parseKey = parseKey;
|
|
42
|
-
function parseMultipleShortcutKeys(keys, splitKey) {
|
|
43
|
-
if (splitKey === void 0) { splitKey = ','; }
|
|
44
|
-
return keys.split(splitKey);
|
|
45
|
-
}
|
|
46
|
-
exports.parseMultipleShortcutKeys = parseMultipleShortcutKeys;
|
|
47
|
-
// NOTE - 설정한 단축키와 사용자가 누르고 있는 key의 일치여부를 판단하는 함수입니다.
|
|
48
|
-
function isKeyMatchingKeyboardEvent(e, key) {
|
|
49
|
-
var alt = key.alt, meta = key.meta, mod = key.mod, shift = key.shift, ctrl = key.ctrl, shortcutKey = key.keys;
|
|
50
|
-
var pressedKeyUppercase = e.key, code = e.code, ctrlKey = e.ctrlKey, metaKey = e.metaKey, shiftKey = e.shiftKey, altKey = e.altKey;
|
|
51
|
-
var keyCode = mapKey(code);
|
|
52
|
-
var pressedKey = pressedKeyUppercase.toLowerCase();
|
|
53
|
-
if (alt === !altKey && pressedKey !== 'alt')
|
|
54
|
-
return false;
|
|
55
|
-
if (shift === !shiftKey && pressedKey !== 'shift')
|
|
56
|
-
return false;
|
|
57
|
-
// NOTE - mod는 macOS에 meta 그리고 다른 platform에서 ctrl을 확인하는 key name입니다.
|
|
58
|
-
if (mod) {
|
|
59
|
-
if (!metaKey && !ctrlKey) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (shortcutKey &&
|
|
72
|
-
shortcutKey.length === 1 &&
|
|
73
|
-
(shortcutKey.includes(pressedKey) || shortcutKey.includes(keyCode))) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
if (shortcutKey)
|
|
77
|
-
return isKeyPressed(shortcutKey);
|
|
78
|
-
if (!shortcutKey)
|
|
79
|
-
return true;
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
exports.isKeyMatchingKeyboardEvent = isKeyMatchingKeyboardEvent;
|
|
83
|
-
// NOTE - 현재 누른 key를 추적하기 위해 중복 요소를 허용하지 않는 데이터 구조인 변수입니다.
|
|
84
|
-
var currentlyPressedKeys = new Set();
|
|
85
|
-
// NOTE - 배열이 초기 생성된 이후 불변성을 유지하고 우발적이거나 무단의 변경을 방지하고 배열인지를 판단하는 함수입니다.
|
|
86
|
-
function isReadonlyArray(value) {
|
|
87
|
-
return Array.isArray(value);
|
|
88
|
-
}
|
|
89
|
-
exports.isReadonlyArray = isReadonlyArray;
|
|
90
|
-
// NOTE - 설정된 단축키와 현재 누른 key의 일치여부를 판단하는 함수입니다.
|
|
91
|
-
function isKeyPressed(shortcutKey, splitKey) {
|
|
92
|
-
if (splitKey === void 0) { splitKey = ','; }
|
|
93
|
-
var keyArray = isReadonlyArray(shortcutKey) ? shortcutKey : shortcutKey.split(splitKey);
|
|
94
|
-
return keyArray.every(function (key) { return currentlyPressedKeys.has(key.trim().toLowerCase()); });
|
|
95
|
-
}
|
|
96
|
-
exports.isKeyPressed = isKeyPressed;
|
|
97
|
-
function isKeyModifier(key) {
|
|
98
|
-
return constants_1.reservedModifierKeywords.includes(key);
|
|
99
|
-
}
|
|
100
|
-
exports.isKeyModifier = isKeyModifier;
|
|
101
|
-
// NOTE - keydown시 누른 key 저장
|
|
102
|
-
function pushToCurrentlyPressedKeys(key) {
|
|
103
|
-
var keyArray = Array.isArray(key) ? key : [key];
|
|
104
|
-
if (currentlyPressedKeys.has('meta')) {
|
|
105
|
-
currentlyPressedKeys.forEach(function (key) { return !isKeyModifier(key) && currentlyPressedKeys.delete(key.toLowerCase()); });
|
|
106
|
-
}
|
|
107
|
-
keyArray.forEach(function (key) { return currentlyPressedKeys.add(key.toLowerCase()); });
|
|
108
|
-
}
|
|
109
|
-
exports.pushToCurrentlyPressedKeys = pushToCurrentlyPressedKeys;
|
|
110
|
-
// NOTE - keyup시 누른 key 삭제
|
|
111
|
-
function removeFromCurrentlyPressedKeys(key) {
|
|
112
|
-
var keyArray = Array.isArray(key) ? key : [key];
|
|
113
|
-
if (key === 'meta') {
|
|
114
|
-
currentlyPressedKeys.clear();
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
keyArray.forEach(function (key) { return currentlyPressedKeys.delete(key.toLowerCase()); });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.removeFromCurrentlyPressedKeys = removeFromCurrentlyPressedKeys;
|
|
121
|
-
// NOTE - 다른 컴포넌트에 동일한 단축키를 사용하는 경우에 서로 다른 scope을 주어 단축키가 가능한 scope인지 아닌지를 판단하는 함수입니다.
|
|
122
|
-
function isScopeActive(activeScopes, scopes) {
|
|
123
|
-
if (activeScopes.length === 0 && scopes) {
|
|
124
|
-
// eslint-disable-next-line no-console
|
|
125
|
-
console.warn('A shortcutKey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <ShortcutKeyProvider>');
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
if (!scopes) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
return activeScopes.some(function (scope) { return scopes.includes(scope); }) || activeScopes.includes('*');
|
|
132
|
-
}
|
|
133
|
-
exports.isScopeActive = isScopeActive;
|
|
134
|
-
// NOTE - keydown 하는 tag의 위치가 input, textarea, select인 경우에는 단축키가 동작하지 않도록 판단하는 함수입니다.
|
|
135
|
-
function isKeyboardEventTriggeredByInput(e) {
|
|
136
|
-
return isShortcutkeyEnabledOnTag(e, ['input', 'textarea', 'select']);
|
|
137
|
-
}
|
|
138
|
-
exports.isKeyboardEventTriggeredByInput = isKeyboardEventTriggeredByInput;
|
|
139
|
-
function isShortcutkeyEnabledOnTag(_a, enabledOnTags) {
|
|
140
|
-
var target = _a.target;
|
|
141
|
-
if (enabledOnTags === void 0) { enabledOnTags = false; }
|
|
142
|
-
var targetTagName = target && target.tagName;
|
|
143
|
-
if (isReadonlyArray(enabledOnTags)) {
|
|
144
|
-
return Boolean(targetTagName &&
|
|
145
|
-
enabledOnTags &&
|
|
146
|
-
enabledOnTags.some(function (tag) { return tag.toLowerCase() === targetTagName.toLowerCase(); }));
|
|
147
|
-
}
|
|
148
|
-
return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
|
|
149
|
-
}
|
|
150
|
-
exports.isShortcutkeyEnabledOnTag = isShortcutkeyEnabledOnTag;
|