rj-grid 0.2.0 → 0.2.1
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/rj-grid.js +17 -1
- package/dist/types/src/query.d.ts +8 -0
- package/package.json +1 -1
package/dist/rj-grid.js
CHANGED
|
@@ -773,6 +773,22 @@ function deriveQueryFields(columns, override) {
|
|
|
773
773
|
}
|
|
774
774
|
return out;
|
|
775
775
|
}
|
|
776
|
+
function withCarrierOptions(fields, carrier) {
|
|
777
|
+
if (!fields.length || !carrier || !carrier.size)
|
|
778
|
+
return fields;
|
|
779
|
+
return fields.map((f) => {
|
|
780
|
+
if (f.options && f.options.length)
|
|
781
|
+
return f;
|
|
782
|
+
const hit = carrier.get(f.field);
|
|
783
|
+
if (!hit || !hit.list || !hit.list.length)
|
|
784
|
+
return f;
|
|
785
|
+
return {
|
|
786
|
+
...f,
|
|
787
|
+
kind: "select",
|
|
788
|
+
options: hit.list.map((o) => ({ label: o.label, value: o.value }))
|
|
789
|
+
};
|
|
790
|
+
});
|
|
791
|
+
}
|
|
776
792
|
function queryOpsOfKind(kind) {
|
|
777
793
|
if (kind === "number")
|
|
778
794
|
return ["eq", "gt", "gte", "lt", "lte", "between"];
|
|
@@ -10098,7 +10114,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10098
10114
|
watch(pipelineCols, (v) => rowModel.setPipelineColumns(v), { immediate: true });
|
|
10099
10115
|
const queryConditions = rowModel.queryConditions;
|
|
10100
10116
|
const queryFieldDefs = computed(
|
|
10101
|
-
() => deriveQueryFields(userColumns.value, props.queryFields)
|
|
10117
|
+
() => withCarrierOptions(deriveQueryFields(userColumns.value, props.queryFields), colOptionsIndex.value)
|
|
10102
10118
|
);
|
|
10103
10119
|
const savedViews = useSavedViews(
|
|
10104
10120
|
() => props.stateKey,
|
|
@@ -9,6 +9,14 @@ export declare function optionsOfColumn(col: RjColumn): RjEditorOption[];
|
|
|
9
9
|
* - 用 override 覆盖标题、类别或候选(宿主可为枚举列补 options)。
|
|
10
10
|
*/
|
|
11
11
|
export declare function deriveQueryFields(columns: RjColumn[], override?: RjQueryFieldDef[]): RjQueryFieldDef[];
|
|
12
|
+
/**
|
|
13
|
+
* 把统一选项载体(异步解析出的候选)并入查询字段池:仅在该字段自身无候选
|
|
14
|
+
* (editor.options / filterValueMap / override 都缺位)时,用载体候选填充并升级为 select 类别。
|
|
15
|
+
* 向后兼容:已有 options 的字段原样保留;carrier 未命中/为空不动。carrier 以 colIdOf 为键。
|
|
16
|
+
*/
|
|
17
|
+
export declare function withCarrierOptions(fields: RjQueryFieldDef[], carrier: Map<string, {
|
|
18
|
+
list: RjEditorOption[];
|
|
19
|
+
}>): RjQueryFieldDef[];
|
|
12
20
|
/** 各类别对应的合理运算符集合 */
|
|
13
21
|
export declare function queryOpsOfKind(kind: RjQueryFieldKind): RjQueryOperator[];
|
|
14
22
|
/** 新增字段时的默认运算符(取该类别最常用的一项) */
|