sellmate-design-system-react 9.0.0-beta.78 → 9.0.0-beta.79
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/SSelect/README.md +1 -1
- package/dist/components/SSelect/SSelect.d.ts +2 -0
- package/dist/index.cjs +45 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -9
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15930,11 +15930,46 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
15930
15930
|
() => new Set(flat.filter((o) => !o.isGroup && o.disabled).map((o) => o.value)),
|
|
15931
15931
|
[flat]
|
|
15932
15932
|
);
|
|
15933
|
-
const
|
|
15934
|
-
|
|
15935
|
-
|
|
15936
|
-
|
|
15937
|
-
|
|
15933
|
+
const fullGroupByLeaf = useMemo(() => {
|
|
15934
|
+
const map = /* @__PURE__ */ new Map();
|
|
15935
|
+
if (!showChips || type !== "multi_depth") return map;
|
|
15936
|
+
flat.forEach((o, i) => {
|
|
15937
|
+
if (!o.isGroup) return;
|
|
15938
|
+
const leafValues = collectGroupLeafValues(flat, i);
|
|
15939
|
+
if (leafValues.length === 0 || leafValues.some((v) => !selectedSet.has(v))) return;
|
|
15940
|
+
if (map.has(leafValues[0])) return;
|
|
15941
|
+
const group = { value: o.value, label: o.label, leafValues };
|
|
15942
|
+
for (let j = i + 1; j < flat.length && flat[j].depth > o.depth; j++) {
|
|
15943
|
+
if (!flat[j].isGroup && selectedSet.has(flat[j].value)) map.set(flat[j].value, group);
|
|
15944
|
+
}
|
|
15945
|
+
});
|
|
15946
|
+
return map;
|
|
15947
|
+
}, [flat, selectedSet, showChips, type]);
|
|
15948
|
+
const chips = [];
|
|
15949
|
+
if (showChips) {
|
|
15950
|
+
const placedGroups = /* @__PURE__ */ new Set();
|
|
15951
|
+
for (const v of selected) {
|
|
15952
|
+
const group = fullGroupByLeaf.get(v);
|
|
15953
|
+
if (group != null) {
|
|
15954
|
+
if (placedGroups.has(group.value)) continue;
|
|
15955
|
+
placedGroups.add(group.value);
|
|
15956
|
+
chips.push({
|
|
15957
|
+
// 그룹 value 와 리프 value 가 겹쳐도 key 가 부딪히지 않게 구분한다.
|
|
15958
|
+
key: `__group_${group.value}__`,
|
|
15959
|
+
label: group.label,
|
|
15960
|
+
values: group.leafValues,
|
|
15961
|
+
removable: !effectiveDisabled
|
|
15962
|
+
});
|
|
15963
|
+
continue;
|
|
15964
|
+
}
|
|
15965
|
+
chips.push({
|
|
15966
|
+
key: v,
|
|
15967
|
+
label: labelByValue.get(v) ?? valueOptions.get(v)?.label ?? v,
|
|
15968
|
+
values: [v],
|
|
15969
|
+
removable: !effectiveDisabled && !disabledValues.has(v)
|
|
15970
|
+
});
|
|
15971
|
+
}
|
|
15972
|
+
}
|
|
15938
15973
|
const isPlaceholder = selected.length === 0;
|
|
15939
15974
|
const showTriggerSpinner = loading2 && !effectiveDisabled;
|
|
15940
15975
|
const showClear = clearable && !effectiveDisabled && !isPlaceholder;
|
|
@@ -15942,8 +15977,9 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
15942
15977
|
emit3([]);
|
|
15943
15978
|
if (rules && rules.length > 0) setRuleError(runRules(multi ? [] : "", rules));
|
|
15944
15979
|
};
|
|
15945
|
-
const handleRemoveChip = (
|
|
15946
|
-
const
|
|
15980
|
+
const handleRemoveChip = (targets) => {
|
|
15981
|
+
const remove = new Set(targets);
|
|
15982
|
+
const next = selected.filter((v) => !remove.has(v));
|
|
15947
15983
|
emit3(next);
|
|
15948
15984
|
if (rules && rules.length > 0) setRuleError(runRules(next, rules));
|
|
15949
15985
|
triggerRef.current?.focus();
|
|
@@ -16163,12 +16199,12 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
16163
16199
|
TriggerRemoveButton,
|
|
16164
16200
|
{
|
|
16165
16201
|
ariaLabel: `${isHtmlLabel(chip.label) ? extractText(chip.label) : chip.label} \uC120\uD0DD \uD574\uC81C`,
|
|
16166
|
-
onRemove: () => handleRemoveChip(chip.
|
|
16202
|
+
onRemove: () => handleRemoveChip(chip.values)
|
|
16167
16203
|
}
|
|
16168
16204
|
)
|
|
16169
16205
|
]
|
|
16170
16206
|
},
|
|
16171
|
-
chip.
|
|
16207
|
+
chip.key
|
|
16172
16208
|
))
|
|
16173
16209
|
}
|
|
16174
16210
|
)
|