import { Schema } from "effect";
import { h } from "vue";
import { Expression } from "../../../../../share/expression.js";
import { columnIdentityFields, registerRowVariablesIfAbsent } from "../../../utils/shared.js";
import Header from "./header.vue";
export const type = "com.shwfed.table.column.select";
export const compatibilityDate = "2026-04-14";
export const metadata = {
  name: "\u9009\u62E9",
  icon: "fluent:checkbox-checked-20-regular"
};
export function schema(configure) {
  const CelRowSelectionPredicate = Expression({
    configure: (env) => {
      configure(env);
      registerRowVariablesIfAbsent(env);
    },
    resultType: "bool"
  });
  return Schema.Struct({
    type: Schema.Literal(type),
    compatibilityDate: Schema.Literal(compatibilityDate),
    ...columnIdentityFields(),
    mode: Schema.optionalWith(Schema.Literal("radio", "checkbox").annotations({
      title: "\u6A21\u5F0F",
      description: "\u9009\u62E9\u6A21\u5F0F\uFF0Cradio \u4E3A\u5355\u9009\uFF0Ccheckbox \u4E3A\u591A\u9009"
    }), { default: () => "checkbox" }),
    enableRowSelection: Schema.optional(CelRowSelectionPredicate).annotations({
      title: "\u884C\u53EF\u9009\u4E2D",
      description: "\u884C\u662F\u5426\u53EF\u9009\u4E2D\u7684 CEL \u8868\u8FBE\u5F0F"
    }),
    enableMultiRowSelection: Schema.optional(CelRowSelectionPredicate).annotations({
      title: "\u884C\u53EF\u591A\u9009",
      description: "\u884C\u662F\u5426\u53EF\u591A\u9009\u7684 CEL \u8868\u8FBE\u5F0F"
    })
  }).annotations({ title: "SelectRenderer", description: "\u9009\u62E9\u6E32\u67D3\u5668" });
}
export function defaults() {
  return {
    mode: "checkbox"
  };
}
export function toColumnDef(value) {
  return {
    header: (ctx) => h(Header, { column: value, ctx }),
    size: 40,
    enableSorting: false,
    enableResizing: false,
    meta: { grow: false }
  };
}
