ingred-ui 31.0.6 → 31.1.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/components/AdvancedFilter/hooks/useAdvancedFilterState.d.ts +4 -2
- package/dist/components/AdvancedFilter/index.d.ts +3 -3
- package/dist/components/AdvancedFilter/styled.d.ts +1 -0
- package/dist/components/AdvancedFilter/types.d.ts +24 -1
- package/dist/components/AdvancedFilter/utils/helpers.d.ts +13 -1
- package/dist/components/AdvancedFilter/utils/operators.d.ts +8 -0
- package/dist/components/AdvancedFilter/utils/positionCalculator.d.ts +5 -1
- package/dist/components/Select2/styled.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Tag/types.d.ts +6 -1
- package/dist/index.es.js +715 -693
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +730 -708
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* メインコンポーネントの複雑性を軽減する。
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import { AppliedFilter, FilterType, FilterConfig } from "../types";
|
|
8
|
+
import { AppliedFilter, FilterType, FilterConfig, AdvancedFilterSelectionMode } from "../types";
|
|
9
9
|
export type UseAdvancedFilterStateProps = {
|
|
10
10
|
types: FilterType[];
|
|
11
|
+
selectionMode?: AdvancedFilterSelectionMode;
|
|
11
12
|
onFiltersChange?: (filters: AppliedFilter[]) => void;
|
|
12
13
|
initialAppliedFilters?: AppliedFilter[];
|
|
13
14
|
};
|
|
@@ -34,10 +35,11 @@ export type UseAdvancedFilterStateReturn = {
|
|
|
34
35
|
y: number;
|
|
35
36
|
} | null) => void;
|
|
36
37
|
handleTypeSelect: (type: string) => void;
|
|
38
|
+
handleSlotClick: (type: string) => void;
|
|
37
39
|
handleConfigApply: (config: FilterConfig) => void;
|
|
38
40
|
handleRemoveFilter: (filterId: string) => void;
|
|
39
41
|
handleClearAll: () => void;
|
|
40
42
|
handleConfigCancel: () => void;
|
|
41
43
|
handleEditFilter: (filter: AppliedFilter) => void;
|
|
42
44
|
};
|
|
43
|
-
export declare const useAdvancedFilterState: ({ types, onFiltersChange, initialAppliedFilters, }: UseAdvancedFilterStateProps) => UseAdvancedFilterStateReturn;
|
|
45
|
+
export declare const useAdvancedFilterState: ({ types, selectionMode, onFiltersChange, initialAppliedFilters, }: UseAdvancedFilterStateProps) => UseAdvancedFilterStateReturn;
|
|
@@ -26,10 +26,10 @@ export { AdvancedFilterTrigger } from "./AdvancedFilterTrigger";
|
|
|
26
26
|
export { AdvancedFilterConfigPanel } from "./AdvancedFilterConfigPanel";
|
|
27
27
|
export { useAdvancedFilterState } from "./hooks/useAdvancedFilterState";
|
|
28
28
|
export { useFilterMenuPosition } from "./hooks/useFilterMenuPosition";
|
|
29
|
-
export { TEXT_OPERATORS, NUMBER_OPERATORS, DATE_OPERATORS, SELECTION_OPERATORS, PRESET_OPERATORS, getPresetOperators, createOperator, combineOperators, overrideOperatorLabels, changeOperatorLabel, getPresetOperatorsWithLabels, selectOperators, selectOperatorsByIndex, applyOperatorToValue, applyFilter, applyMultipleFilters, evaluateFilterConditions, } from "./utils/operators";
|
|
29
|
+
export { TEXT_OPERATORS, NUMBER_OPERATORS, DATE_OPERATORS, SELECTION_OPERATORS, PRESET_OPERATORS, getPresetOperators, createOperator, combineOperators, overrideOperatorLabels, changeOperatorLabel, getPresetOperatorsWithLabels, selectOperators, selectOperatorsByIndex, applyOperatorToValue, applyFilter, applyMultipleFilters, evaluateFilterConditions, normalizeForSearch, } from "./utils/operators";
|
|
30
30
|
export { createValue, combineValues, overrideValueLabels, changeValueLabel, selectValues, selectValuesByIndex, getValueStrings, getValueLabels, getLabelsForValues, mergeValues, sortValues, } from "./utils/values";
|
|
31
31
|
export type { ValueDefinition } from "./utils/values";
|
|
32
|
-
export { isRangeOperator, isCustomOperator, isValidFilterConfig, isValidFilterType, generateTagText, generateTagTitle, getTagBoldText, getAvailableTypes, getFilterTypeLabel, } from "./utils/helpers";
|
|
32
|
+
export { isRangeOperator, isCustomOperator, isValidFilterConfig, isValidFilterType, generateTagText, generateTagTitle, getTagBoldText, getAvailableTypes, getFilterTypeLabel, buildFilterSlots, getPresetSlotId, isConfiguredFilter, getConfiguredFilters, } from "./utils/helpers";
|
|
33
33
|
export { FilterPositionCalculator } from "./utils/positionCalculator";
|
|
34
34
|
export { ADVANCED_FILTER_CONSTANTS } from "./constants";
|
|
35
|
-
export type { AdvancedFilterProps, FilterType, FilterTypeConfig, FilterConfig, AppliedFilter, OperatorDefinition, AdvancedFilterSize, AdvancedFilterVariant, FilterOperator, FilterInputType, FilterPresetType, } from "./types";
|
|
35
|
+
export type { AdvancedFilterProps, FilterType, FilterTypeConfig, FilterConfig, AppliedFilter, OperatorDefinition, AdvancedFilterSize, AdvancedFilterVariant, FilterOperator, FilterInputType, FilterPresetType, AdvancedFilterSelectionMode, FilterSlotView, } from "./types";
|
|
@@ -82,6 +82,7 @@ export declare const IconArea: import("styled-components/dist/types").IStyledCom
|
|
|
82
82
|
/**
|
|
83
83
|
* 中央:タグエリア
|
|
84
84
|
*/
|
|
85
|
+
export declare const CONFIGURED_PRESET_SLOT_TAG_CLASS = "ingred-advanced-filter-configured-tag";
|
|
85
86
|
export declare const TagArea: import("styled-components/dist/types").IStyledComponentBase<"web", any> & string;
|
|
86
87
|
/**
|
|
87
88
|
* プレースホルダーテキスト
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* 注: FilterOperator, FilterInputType, FilterPresetType は src/utils/filterTypes.ts で
|
|
15
15
|
* 定義され、本ファイルから re-export しています。
|
|
16
16
|
*/
|
|
17
|
+
import type { MouseEvent } from "react";
|
|
17
18
|
import { Theme } from "../../themes";
|
|
18
19
|
import type { FilterOperator, FilterInputType, FilterPresetType } from "../../utils/filterTypes";
|
|
19
20
|
export type { FilterOperator, FilterInputType, FilterPresetType };
|
|
@@ -22,6 +23,20 @@ export type FilterType = {
|
|
|
22
23
|
label: string;
|
|
23
24
|
disabled?: boolean;
|
|
24
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* フィルター選択 UI のモード
|
|
28
|
+
* - menu: メニューからタイプを選んで追加(default)
|
|
29
|
+
* - presetSlots: types 分のスロットを常時表示。未設定はタイプ名のみ、クリックで ConfigPanel を直接開く
|
|
30
|
+
*/
|
|
31
|
+
export type AdvancedFilterSelectionMode = "menu" | "presetSlots";
|
|
32
|
+
/** presetSlots モード用の表示スロット */
|
|
33
|
+
export type FilterSlotView = {
|
|
34
|
+
type: string;
|
|
35
|
+
typeLabel: string;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
slotId: string;
|
|
38
|
+
filter: AppliedFilter | null;
|
|
39
|
+
};
|
|
25
40
|
export type OperatorDefinition = {
|
|
26
41
|
value: FilterOperator | (string & {});
|
|
27
42
|
label: string;
|
|
@@ -148,14 +163,22 @@ export type AdvancedFilterProps = {
|
|
|
148
163
|
onFiltersChange?: (filters: AppliedFilter[]) => void;
|
|
149
164
|
/** Story等で初期表示用に事前適用されたフィルターを指定する */
|
|
150
165
|
initialAppliedFilters?: AppliedFilter[];
|
|
166
|
+
/**
|
|
167
|
+
* フィルター選択 UI のモード
|
|
168
|
+
* @default 'menu'
|
|
169
|
+
*/
|
|
170
|
+
selectionMode?: AdvancedFilterSelectionMode;
|
|
151
171
|
};
|
|
152
172
|
export type AdvancedFilterTriggerProps = {
|
|
153
173
|
placeholder?: string;
|
|
154
174
|
disabled?: boolean;
|
|
155
175
|
isOpen?: boolean;
|
|
156
|
-
onClick?: () => void;
|
|
176
|
+
onClick?: (event?: MouseEvent) => void;
|
|
157
177
|
appliedFilters?: AppliedFilter[];
|
|
178
|
+
selectionMode?: AdvancedFilterSelectionMode;
|
|
179
|
+
filterSlots?: FilterSlotView[];
|
|
158
180
|
onEditFilter?: (filter: AppliedFilter) => void;
|
|
181
|
+
onSlotClick?: (type: string) => void;
|
|
159
182
|
onRemoveFilter?: (filterId: string) => void;
|
|
160
183
|
onClearAll?: () => void;
|
|
161
184
|
size?: "small" | "medium" | "large";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - タグ表示: タグのテキスト・タイトル生成
|
|
12
12
|
* - バリデーション: フィルター設定・タイプの有効性チェック
|
|
13
13
|
*/
|
|
14
|
-
import { AppliedFilter, FilterConfig, FilterInputType, FilterTypeConfig, MultiFilterConditionConfig, OperatorDefinition, ValueDefinition } from "../types";
|
|
14
|
+
import { AppliedFilter, FilterConfig, FilterInputType, FilterSlotView, FilterTypeConfig, MultiFilterConditionConfig, OperatorDefinition, ValueDefinition } from "../types";
|
|
15
15
|
/**
|
|
16
16
|
* 範囲指定が必要なオペレーターかどうかを判定
|
|
17
17
|
* @param operator オペレーターのvalue
|
|
@@ -159,4 +159,16 @@ type ConditionForTextFocus = {
|
|
|
159
159
|
* 複数条件モードで最初のテキスト入力条件の ID を取得する
|
|
160
160
|
*/
|
|
161
161
|
export declare const getFirstTextConditionId: (filterConfig: FilterTypeConfig | undefined, conditions: ConditionForTextFocus[]) => string | null;
|
|
162
|
+
/** 未設定スロットの安定 ID */
|
|
163
|
+
export declare const getPresetSlotId: (type: string) => string;
|
|
164
|
+
/** 設定済み(値が入っている)フィルターかどうか */
|
|
165
|
+
export declare const isConfiguredFilter: (filter: AppliedFilter) => boolean;
|
|
166
|
+
/** 設定済みフィルターのみ返す */
|
|
167
|
+
export declare const getConfiguredFilters: (appliedFilters: AppliedFilter[]) => AppliedFilter[];
|
|
168
|
+
/** types と appliedFilters から presetSlots 表示用スロットを構築 */
|
|
169
|
+
export declare const buildFilterSlots: (types: Array<{
|
|
170
|
+
type: string;
|
|
171
|
+
label: string;
|
|
172
|
+
disabled?: boolean;
|
|
173
|
+
}>, appliedFilters: AppliedFilter[]) => FilterSlotView[];
|
|
162
174
|
export {};
|
|
@@ -69,6 +69,14 @@ export declare const selectOperators: (operators: OperatorDefinition[], values:
|
|
|
69
69
|
* オペレーター配列から指定されたインデックスの要素のみを抽出
|
|
70
70
|
*/
|
|
71
71
|
export declare const selectOperatorsByIndex: (operators: OperatorDefinition[], indices: number[]) => OperatorDefinition[];
|
|
72
|
+
/**
|
|
73
|
+
* フィルタリング処理用のヘルパー関数群
|
|
74
|
+
* 実際のデータフィルタリング処理で使用
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* 文字列比較用の正規化(大文字小文字・全角半角を区別しない)
|
|
78
|
+
*/
|
|
79
|
+
export declare const normalizeForSearch: (value: string) => string;
|
|
72
80
|
/**
|
|
73
81
|
* 単一の値に対してオペレーターを適用
|
|
74
82
|
*/
|
|
@@ -27,9 +27,13 @@ export declare class FilterPositionCalculator {
|
|
|
27
27
|
*/
|
|
28
28
|
private static calculateSafePosition;
|
|
29
29
|
/**
|
|
30
|
-
* ConfigPanel
|
|
30
|
+
* ConfigPanelの座標を計算(AppliedFilter 用。後方互換)
|
|
31
31
|
*/
|
|
32
32
|
static calculateConfigPanelPosition(filter: AppliedFilter, appliedFilters: AppliedFilter[], triggerRef: React.RefObject<HTMLDivElement>): MenuPosition;
|
|
33
|
+
/**
|
|
34
|
+
* ConfigPanelの座標を計算(slotId ベース。presetSlots モード用)
|
|
35
|
+
*/
|
|
36
|
+
static calculateConfigPanelPositionBySlotId(slotId: string, slotIndex: number, triggerRef: React.RefObject<HTMLDivElement>): MenuPosition;
|
|
33
37
|
/**
|
|
34
38
|
* 実際のDOM要素から座標を計算
|
|
35
39
|
*/
|
|
@@ -7,7 +7,7 @@ export declare const SelectLabel: import("styled-components/dist/types").IStyled
|
|
|
7
7
|
export declare const SelectLabelText: import("styled-components/dist/types").IStyledComponentBase<"web", any> & string;
|
|
8
8
|
export declare const SelectLabelIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<any, never> & Partial<Pick<any, never>>> & string;
|
|
9
9
|
export declare const TagContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<any, never> & Partial<Pick<any, never>>> & string;
|
|
10
|
-
export declare const StyledTag: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Tag").TagProps, never> & Partial<Pick<import("../Tag").TagProps, never>>> & string & Omit<({ label, size, variant, onRemove, className, disabled, boldText, onClick, "aria-label": ariaLabel, "data-tag": dataTag, prepend, }: import("../Tag").TagProps) => JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
10
|
+
export declare const StyledTag: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Tag").TagProps, never> & Partial<Pick<import("../Tag").TagProps, never>>> & string & Omit<({ label, size, variant, onRemove, className, disabled, boldText, onClick, onPointerDown, "aria-label": ariaLabel, "data-tag": dataTag, prepend, }: import("../Tag").TagProps) => JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
11
11
|
export declare const Placeholder: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<any, never> & Partial<Pick<any, never>>> & string;
|
|
12
12
|
export declare const IconArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<any, never> & Partial<Pick<any, never>>> & string;
|
|
13
13
|
export declare const StyledContextMenu2TextInputItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TagProps } from "./types";
|
|
3
|
-
export declare const Tag: ({ label, size, variant, onRemove, className, disabled, boldText, onClick, "aria-label": ariaLabel, "data-tag": dataTag, prepend, }: TagProps) => JSX.Element;
|
|
3
|
+
export declare const Tag: ({ label, size, variant, onRemove, className, disabled, boldText, onClick, onPointerDown, "aria-label": ariaLabel, "data-tag": dataTag, prepend, }: TagProps) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { PointerEventHandler, ReactNode } from "react";
|
|
2
2
|
export type TagSize = "small" | "medium" | "large" | "xl";
|
|
3
3
|
export type TagVariant = "light" | "dark";
|
|
4
4
|
export type TagProps = {
|
|
@@ -10,6 +10,11 @@ export type TagProps = {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
boldText?: string | string[];
|
|
12
12
|
onClick?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* ポインター押下時(マウス・タッチ)。`preventDefault` でフォーカス移動によるスクロールを抑止する用途向け。
|
|
15
|
+
* タッチでは `onMouseDown` だけでは効かないことがある。
|
|
16
|
+
*/
|
|
17
|
+
onPointerDown?: PointerEventHandler<HTMLDivElement>;
|
|
13
18
|
"aria-label"?: string;
|
|
14
19
|
"data-tag"?: string;
|
|
15
20
|
prepend?: ReactNode;
|