@kne/table-page 0.1.22 → 0.1.23
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 +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +13 -2
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -2659,9 +2659,11 @@ const TableToolbar = ({
|
|
|
2659
2659
|
/**
|
|
2660
2660
|
* 与 @kne/react-filter useSearchParamsValue 内部解析保持一致(不从该包导出)。
|
|
2661
2661
|
*
|
|
2662
|
+
* fields 项:`name` 为 URL key;`label` 为筛选项标题;可选 `labelKey` 为选中值展示文案的 URL key。
|
|
2663
|
+
*
|
|
2662
2664
|
* @param {Object} [options]
|
|
2663
2665
|
* @param {URLSearchParams} [options.searchParams]
|
|
2664
|
-
* @param {Array<{ name: string, label?: string }>} [options.fields]
|
|
2666
|
+
* @param {Array<{ name: string, label?: string, labelKey?: string }>} [options.fields]
|
|
2665
2667
|
* @returns {{ items: Array, consumedKeys: string[] }}
|
|
2666
2668
|
*/
|
|
2667
2669
|
const parseSearchParamsValue = ({
|
|
@@ -2686,12 +2688,21 @@ const parseSearchParamsValue = ({
|
|
|
2686
2688
|
return;
|
|
2687
2689
|
}
|
|
2688
2690
|
consumedKeys.push(name);
|
|
2691
|
+
let valueText = raw;
|
|
2692
|
+
const labelKey = field.labelKey;
|
|
2693
|
+
if (labelKey && searchParams.has(labelKey)) {
|
|
2694
|
+
const fromLabelKey = searchParams.get(labelKey);
|
|
2695
|
+
if (fromLabelKey != null && fromLabelKey !== '') {
|
|
2696
|
+
valueText = fromLabelKey;
|
|
2697
|
+
consumedKeys.push(labelKey);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2689
2700
|
const label = field.label != null ? field.label : name;
|
|
2690
2701
|
items.push({
|
|
2691
2702
|
name,
|
|
2692
2703
|
label,
|
|
2693
2704
|
value: {
|
|
2694
|
-
label:
|
|
2705
|
+
label: valueText,
|
|
2695
2706
|
value: raw
|
|
2696
2707
|
}
|
|
2697
2708
|
});
|