@shwfed/config 2.1.0 → 2.1.2
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/module.json +1 -1
- package/dist/runtime/components/form/ai/fields-button.d.vue.ts +13 -0
- package/dist/runtime/components/form/ai/fields-button.vue +458 -0
- package/dist/runtime/components/form/ai/fields-button.vue.d.ts +13 -0
- package/dist/runtime/components/form/ai/fields-task.md +71 -0
- package/dist/runtime/components/form/config.d.vue.ts +1 -1
- package/dist/runtime/components/form/config.vue +4 -36
- package/dist/runtime/components/form/config.vue.d.ts +1 -1
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +12 -12
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue +87 -11
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +12 -12
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +18 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.d.ts +1 -1
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.js +11 -4
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +12 -12
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +12 -12
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.d.vue.ts +16 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue +37 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue.d.ts +16 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.d.vue.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue +13 -4
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue.d.ts +1 -0
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +111 -22
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.d.ts +15 -1
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.js +9 -1
- package/dist/runtime/components/form/index.vue +5 -4
- package/dist/runtime/components/form/unit-config.d.vue.ts +16 -0
- package/dist/runtime/components/form/unit-config.vue +30 -3
- package/dist/runtime/components/form/unit-config.vue.d.ts +16 -0
- package/dist/runtime/components/form/utils/cel-scope.d.ts +13 -0
- package/dist/runtime/components/form/utils/cel-scope.js +32 -0
- package/dist/runtime/components/form/utils/schema-meta.d.ts +13 -0
- package/dist/runtime/components/form/utils/schema-meta.js +15 -0
- package/dist/runtime/components/table/ai/columns-task.md +10 -1
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/config.vue +2 -2
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/runtime.vue +14 -4
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/schema.js +3 -2
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/config.vue +2 -2
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/runtime.vue +14 -4
- package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.js +3 -2
- package/dist/runtime/components/table/utils/shared.d.ts +2 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +1 -1
- package/dist/runtime/share/expression.d.ts +1 -2
- package/dist/runtime/share/slot-renderer.vue +7 -6
- package/dist/runtime/utils/interpolate.d.ts +1 -0
- package/dist/runtime/utils/interpolate.js +7 -0
- package/dist/runtime/vendor/cel-js/CLAUDE.md +1 -1
- package/dist/runtime/vendor/cel-js/PROMPT.md +6 -1
- package/dist/runtime/vendor/cel-js/lib/http-builder.d.ts +3 -2
- package/dist/runtime/vendor/cel-js/lib/http-builtins.d.ts +4 -3
- package/dist/runtime/vendor/cel-js/lib/http-builtins.js +4 -0
- package/package.json +1 -1
package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/runtime.vue
CHANGED
|
@@ -16,12 +16,22 @@ const rawValue = computed(() => props.ctx.cell.getValue());
|
|
|
16
16
|
const isMissing = computed(() => rawValue.value === void 0 || rawValue.value === null);
|
|
17
17
|
const align = computed(() => isMissing.value ? "center" : props.column.align ?? "left");
|
|
18
18
|
const justifyClass = computed(() => JUSTIFY_CLASS[align.value] ?? JUSTIFY_CLASS.left);
|
|
19
|
-
const
|
|
19
|
+
const copyText = computed(() => {
|
|
20
|
+
const { copyExpression } = props.column;
|
|
21
|
+
if (!copyExpression) return void 0;
|
|
22
|
+
try {
|
|
23
|
+
const value = Effect.runSync($cel(copyExpression, celBindings(celContext)));
|
|
24
|
+
return value === void 0 || value === null ? void 0 : String(value);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.error("[shwfed-table] text copy expression failed", e);
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const showCopy = computed(() => copyText.value !== void 0 && !isMissing.value && rawValue.value !== "");
|
|
20
31
|
const onCopy = async () => {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
32
|
+
const text = copyText.value;
|
|
33
|
+
if (text === void 0) return;
|
|
23
34
|
try {
|
|
24
|
-
const text = String(Effect.runSync($cel(column.copyExpression, celBindings(celContext))));
|
|
25
35
|
await navigator.clipboard.writeText(text);
|
|
26
36
|
} catch (e) {
|
|
27
37
|
console.error("[shwfed-table] text copy failed", e);
|
package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.js
CHANGED
|
@@ -6,8 +6,9 @@ export const metadata = {
|
|
|
6
6
|
name: "\u6587\u672C",
|
|
7
7
|
icon: "fluent:text-field-20-regular"
|
|
8
8
|
};
|
|
9
|
+
const isCopyExpressionType = (t) => t === "string" || t === "dyn" || t.startsWith("optional");
|
|
9
10
|
export function schema(configure) {
|
|
10
|
-
const cel = CelRowAccess(configure, { resultType:
|
|
11
|
+
const cel = CelRowAccess(configure, { resultType: isCopyExpressionType });
|
|
11
12
|
return Schema.Struct({
|
|
12
13
|
type: Schema.Literal(type),
|
|
13
14
|
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
@@ -22,7 +23,7 @@ export function schema(configure) {
|
|
|
22
23
|
),
|
|
23
24
|
copyExpression: Schema.optional(cel.annotations({
|
|
24
25
|
title: "\u590D\u5236\u8868\u8FBE\u5F0F",
|
|
25
|
-
description: "\u590D\u5236\u503C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u5B58\u5728\u65F6\u542F\u7528\u590D\u5236\u529F\u80FD"
|
|
26
|
+
description: "\u590D\u5236\u503C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u5B58\u5728\u65F6\u542F\u7528\u590D\u5236\u529F\u80FD\uFF1B\u53EF\u8FD4\u56DE optional\uFF08\u5982 `row.?field`\uFF09\uFF0C\u4E3A\u7A7A\u65F6\u4E0D\u663E\u793A\u590D\u5236\u6309\u94AE"
|
|
26
27
|
}))
|
|
27
28
|
}).annotations({ title: "TextRenderer", description: "\u6587\u672C\u6E32\u67D3\u5668" });
|
|
28
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import type { Environment } from '../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
import { type ResultType } from '../../../share/expression.js';
|
|
3
4
|
export declare const Align: Schema.Literal<["left", "center", "right"]>;
|
|
4
5
|
export declare function columnIdentityFields(): {
|
|
5
6
|
id: Schema.refine<string, typeof Schema.String>;
|
|
@@ -29,7 +30,7 @@ export declare function columnFields(configure: (env: Environment) => void): {
|
|
|
29
30
|
};
|
|
30
31
|
export declare function registerRowVariablesIfAbsent(env: Environment): void;
|
|
31
32
|
export declare function CelRowAccess(configure: (env: Environment) => void, options?: {
|
|
32
|
-
resultType?:
|
|
33
|
+
resultType?: ResultType;
|
|
33
34
|
}): Schema.Schema<string, string, never>;
|
|
34
35
|
export declare function LocaleMarkdownWithRow(configure: (env: Environment) => void): Schema.filter<Schema.TupleType<readonly [Schema.Struct<{
|
|
35
36
|
locale: Schema.Literal<["zh"]>;
|
|
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
15
|
"onUpdate:modelValue"?: ((args_0: DateRange | undefined) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
+
rangeSeparatorIcon: string;
|
|
17
18
|
numberOfMonths: number;
|
|
18
19
|
granularity: "hour" | "minute" | "second";
|
|
19
20
|
hourCycle: 12 | 24;
|
|
20
|
-
rangeSeparatorIcon: string;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
15
|
"onUpdate:modelValue"?: ((args_0: DateRange | undefined) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
+
rangeSeparatorIcon: string;
|
|
17
18
|
numberOfMonths: number;
|
|
18
19
|
granularity: "hour" | "minute" | "second";
|
|
19
20
|
hourCycle: 12 | 24;
|
|
20
|
-
rangeSeparatorIcon: string;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -24,11 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
24
24
|
"onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
size: "sm" | "md" | "lg";
|
|
27
|
+
rangeSeparatorIcon: string;
|
|
27
28
|
granularity: "hour" | "minute" | "second";
|
|
28
29
|
hourCycle: 12 | 24;
|
|
29
30
|
clearable: boolean;
|
|
30
31
|
clearIcon: string;
|
|
31
|
-
rangeSeparatorIcon: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
34
34
|
export default _default;
|
|
@@ -24,11 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
24
24
|
"onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
size: "sm" | "md" | "lg";
|
|
27
|
+
rangeSeparatorIcon: string;
|
|
27
28
|
granularity: "hour" | "minute" | "second";
|
|
28
29
|
hourCycle: 12 | 24;
|
|
29
30
|
clearable: boolean;
|
|
30
31
|
clearIcon: string;
|
|
31
|
-
rangeSeparatorIcon: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
34
34
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { Environment } from '../vendor/cel-js/lib/index.js';
|
|
3
3
|
import { Locale } from './locale.js';
|
|
4
|
-
type ResultType = string | string[] | ((type: string) => boolean);
|
|
4
|
+
export type ResultType = string | string[] | ((type: string) => boolean);
|
|
5
5
|
export declare function Expression(options: {
|
|
6
6
|
configure: (env: Environment) => void;
|
|
7
7
|
resultType?: ResultType;
|
|
@@ -19,4 +19,3 @@ export declare function Markdown(options: {
|
|
|
19
19
|
export declare function LocaleMarkdown(options: {
|
|
20
20
|
configure: (env: Environment) => void;
|
|
21
21
|
}): Schema.filter<typeof Locale>;
|
|
22
|
-
export {};
|
|
@@ -35,14 +35,15 @@ watch(() => props.slotValue.layouts, (sets) => {
|
|
|
35
35
|
const gridStyle = computed(() => {
|
|
36
36
|
const l = activeLayout.value?.layout;
|
|
37
37
|
if (!l) return "";
|
|
38
|
-
const tracks = (n) => `repeat(${n}, minmax(
|
|
38
|
+
const tracks = (n, min) => `repeat(${n}, minmax(${min}, 1fr))`;
|
|
39
|
+
const gap = `calc(${l.gap ?? DEFAULT_GAP} * 0.25rem)`;
|
|
40
|
+
const colGap = l.columns > 1 ? `min(${gap}, calc(100% / ${l.columns - 1}))` : gap;
|
|
39
41
|
const parts = [
|
|
40
42
|
"display: grid",
|
|
41
|
-
`grid-template-columns: ${tracks(l.columns)}`,
|
|
42
|
-
l.rows ? `grid-template-rows: ${tracks(l.rows)}` : "",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
`gap: calc(${l.gap ?? DEFAULT_GAP} * 0.25rem)`,
|
|
43
|
+
`grid-template-columns: ${tracks(l.columns, "0")}`,
|
|
44
|
+
l.rows ? `grid-template-rows: ${tracks(l.rows, "auto")}` : "",
|
|
45
|
+
`column-gap: ${colGap}`,
|
|
46
|
+
`row-gap: ${gap}`,
|
|
46
47
|
l.style ?? ""
|
|
47
48
|
].filter(Boolean);
|
|
48
49
|
return parts.join("; ");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function interpolate(template: string, evaluate: (expression: string) => string): string;
|
|
@@ -20,7 +20,7 @@ The `homogeneousAggregateLiterals` and `enableOptionalTypes` environment options
|
|
|
20
20
|
|
|
21
21
|
The custom `Optional` class has been replaced with Effect's `Option` type (`import { Option } from 'effect'`). Internal helpers `optionalOf(value)` and `optionalValue(opt)` in `optional.js` handle the CEL-specific semantics (treating `undefined` as `None`, throwing `EvaluationError` on missing value access).
|
|
22
22
|
|
|
23
|
-
An `http` built-in has been added (`http-builtins.ts`, `http-builder.ts`) — not from upstream. It registers the `http` constant and the `http` / `HttpRequest` types on `globalRegistry`, so `http.get(url).header(...).body(...)` expressions type-check and evaluate in every `Environment`. A CEL expression
|
|
23
|
+
An `http` built-in has been added (`http-builtins.ts`, `http-builder.ts`) — not from upstream. It registers the `http` constant and the `http` / `HttpRequest` types on `globalRegistry`, so `http.get(url).header(...).body(...)` expressions type-check and evaluate in every `Environment`. A CEL expression builds an `HttpRequestBuilder`; the terminal `HttpRequest.file(): File` method issues the request and evaluates to the downloaded `File`, while `.json()` is dispatched by the host on the builder value (it is not a CEL method). Endpoints must be absolute URLs — there is no base-URL resolution. Depends on `fx-fetch`.
|
|
24
24
|
|
|
25
25
|
## Architecture
|
|
26
26
|
|
|
@@ -197,7 +197,7 @@ location.param("id") // first value when a param repeats
|
|
|
197
197
|
|
|
198
198
|
## HTTP
|
|
199
199
|
|
|
200
|
-
Build HTTP requests using the `http` builder. CEL
|
|
200
|
+
Build HTTP requests using the `http` builder. A CEL expression *describes* a request; calling `.file()` on it issues the request and evaluates to the downloaded `File`. Any other request is handed to the host to dispatch — there is no way to read a JSON or text response from CEL.
|
|
201
201
|
|
|
202
202
|
**URLs must be absolute** — pass a full `https://…` URL. There is no base URL, so relative paths like `/api/users` will not resolve.
|
|
203
203
|
|
|
@@ -236,6 +236,11 @@ http.post("https://api.example.com/users")
|
|
|
236
236
|
.header("Content-Type", "application/json")
|
|
237
237
|
.body({"name": "Alice", "channel": query.?channel})
|
|
238
238
|
|
|
239
|
+
// Download the response as a File. Unlike the chainable methods above,
|
|
240
|
+
// .file() is terminal — it issues the request and the expression evaluates
|
|
241
|
+
// to a File (filename from the Content-Disposition header, else the URL path):
|
|
242
|
+
http.get("https://api.example.com/files/report.pdf").file()
|
|
243
|
+
|
|
239
244
|
// Full example — the expression returns an HttpRequest; the host sends it:
|
|
240
245
|
http.post("https://api.example.com/users")
|
|
241
246
|
.header("Content-Type", "application/json")
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `HttpRequestBuilder` — the value an `http.*` CEL expression evaluates to.
|
|
3
3
|
*
|
|
4
|
-
* A local (non-upstream) extension. CEL
|
|
5
|
-
*
|
|
4
|
+
* A local (non-upstream) extension. A CEL expression builds and *describes* a
|
|
5
|
+
* request; `.file()` is exposed as a CEL method and evaluates to the downloaded
|
|
6
|
+
* `File`, while `.json()` is dispatched by the host on the returned builder.
|
|
6
7
|
*
|
|
7
8
|
* Endpoints are used verbatim — there is no base-URL resolution, so callers
|
|
8
9
|
* must pass absolute URLs.
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* HTTP built-ins for CEL — a local (non-upstream) extension.
|
|
3
3
|
*
|
|
4
4
|
* Registers the `http` / `HttpRequest` types, the `http` constant, and the
|
|
5
|
-
* request-builder functions on the registry.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* request-builder functions on the registry. `http.get(url).header(...).body(...)`
|
|
6
|
+
* builds an `HttpRequestBuilder`; the terminal `.file()` method issues the
|
|
7
|
+
* request and evaluates to the downloaded `File`. `.json()` is *not* a CEL
|
|
8
|
+
* method — the host dispatches that on the returned builder value.
|
|
8
9
|
*
|
|
9
10
|
* Wired into `globalRegistry` at module load (see `evaluator.ts`), so every
|
|
10
11
|
* `Environment` gets HTTP for free — both type-checking and evaluation.
|