@shwfed/config 1.0.0 → 1.0.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.
Files changed (47) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +117 -23
  3. package/dist/runtime/components/config/footer.vue +0 -2
  4. package/dist/runtime/components/config/index.vue +13 -3
  5. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +2 -2
  6. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue +85 -10
  7. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +2 -2
  8. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +18 -6
  9. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.d.ts +1 -1
  10. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.js +11 -4
  11. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +2 -2
  12. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue +85 -10
  13. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +2 -2
  14. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +18 -6
  15. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.d.ts +1 -1
  16. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.js +11 -4
  17. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +2 -2
  18. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue +87 -11
  19. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +2 -2
  20. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/runtime.vue +18 -6
  21. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.d.ts +1 -1
  22. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.js +11 -4
  23. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue +3 -0
  24. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/runtime.vue +8 -0
  25. package/dist/runtime/components/form/index.vue +2 -2
  26. package/dist/runtime/components/table/ai/columns-button.vue +91 -98
  27. package/dist/runtime/components/table/ai/data-source-button.vue +88 -95
  28. package/dist/runtime/components/table/index.vue +5 -7
  29. package/dist/runtime/plugins/ai/index.d.ts +1 -5
  30. package/dist/runtime/plugins/ai/index.js +185 -441
  31. package/dist/runtime/plugins/cel/index.js +7 -0
  32. package/dist/runtime/vendor/cel-js/PROMPT.md +8 -0
  33. package/package.json +4 -4
  34. package/dist/chunks/index.mjs +0 -212742
  35. package/dist/runtime/components/ai/byok-button.d.vue.ts +0 -3
  36. package/dist/runtime/components/ai/byok-button.vue +0 -48
  37. package/dist/runtime/components/ai/byok-button.vue.d.ts +0 -3
  38. package/dist/runtime/components/ai/byok-settings.d.vue.ts +0 -3
  39. package/dist/runtime/components/ai/byok-settings.vue +0 -282
  40. package/dist/runtime/components/ai/byok-settings.vue.d.ts +0 -3
  41. package/dist/runtime/plugins/ai/gate.d.ts +0 -1
  42. package/dist/runtime/plugins/ai/gate.js +0 -8
  43. package/dist/runtime/plugins/ai/settings-state.d.ts +0 -1
  44. package/dist/runtime/plugins/ai/settings-state.js +0 -2
  45. package/dist/runtime/plugins/ai/store.d.ts +0 -17
  46. package/dist/runtime/plugins/ai/store.js +0 -40
  47. package/dist/shared/config.DW2OtAXe.mjs +0 -86529
@@ -48,13 +48,8 @@ const description = [
48
48
  "",
49
49
  "AI \u4F1A\u6839\u636E\u63CF\u8FF0\u751F\u6210 `\u8BF7\u6C42` / `\u6570\u636E` / `\u603B\u6570` \u4E09\u4E2A CEL \u5B57\u6BB5\u3002"
50
50
  ].join("\n");
51
- const visible = computed(() => $ai.available.value);
52
51
  const canSubmit = computed(() => !submitting.value && context.value.trim().length > 0);
53
52
  function onTrigger() {
54
- if (!$ai.available.value) {
55
- $ai.openSettings();
56
- return;
57
- }
58
53
  open.value = true;
59
54
  }
60
55
  function checkCelString(expr) {
@@ -230,101 +225,99 @@ async function onSubmit() {
230
225
  </script>
231
226
 
232
227
  <template>
233
- <template v-if="visible">
234
- <Tooltip :delay-duration="180">
235
- <TooltipTrigger as-child>
236
- <button
237
- type="button"
238
- class="ai-trigger"
239
- :disabled="submitting"
240
- @click="onTrigger"
241
- >
242
- <Icon
243
- icon="fluent:magic-wand-20-regular"
244
- class="size-4"
245
- />
246
- </button>
247
- </TooltipTrigger>
248
- <TooltipContent side="right">
249
- AI 生成数据源
250
- </TooltipContent>
251
- </Tooltip>
252
-
253
- <ShwfedModal
254
- v-model:open="open"
255
- content-width="48rem"
256
- :dismissible="!submitting"
257
- >
258
- <template #title>
259
- <span class="flex items-center gap-2">
260
- <Icon
261
- icon="fluent:magic-wand-20-regular"
262
- class="size-5"
263
- />
264
- AI 生成数据源
265
- </span>
266
- </template>
267
- <template #description>
268
- <Markdown
269
- :source="description"
270
- block
271
- class="prose prose-sm prose-zinc max-w-none"
228
+ <Tooltip :delay-duration="180">
229
+ <TooltipTrigger as-child>
230
+ <button
231
+ type="button"
232
+ class="ai-trigger"
233
+ :disabled="submitting"
234
+ @click="onTrigger"
235
+ >
236
+ <Icon
237
+ icon="fluent:magic-wand-20-regular"
238
+ class="size-4"
272
239
  />
273
- </template>
240
+ </button>
241
+ </TooltipTrigger>
242
+ <TooltipContent side="right">
243
+ AI 生成数据源
244
+ </TooltipContent>
245
+ </Tooltip>
274
246
 
275
- <form
276
- class="flex flex-col gap-2 py-2"
277
- @submit.prevent="onSubmit"
278
- >
279
- <Textarea
280
- v-model="context"
281
- placeholder="任意上下文,建议包含:&#10;- 接口路径与方法(如 GET /api/users)&#10;- 查询参数与分页约定(page 是否从 1 开始?)&#10;- 示例响应(JSON),尤其是数据列表与总数字段名"
282
- wrap="soft"
283
- class="field-sizing-fixed h-72 max-h-[60vh] resize-none overflow-auto break-all whitespace-pre-wrap font-mono text-xs"
284
- :disabled="submitting"
247
+ <ShwfedModal
248
+ v-model:open="open"
249
+ content-width="48rem"
250
+ :dismissible="!submitting"
251
+ >
252
+ <template #title>
253
+ <span class="flex items-center gap-2">
254
+ <Icon
255
+ icon="fluent:magic-wand-20-regular"
256
+ class="size-5"
285
257
  />
286
- </form>
258
+ AI 生成数据源
259
+ </span>
260
+ </template>
261
+ <template #description>
262
+ <Markdown
263
+ :source="description"
264
+ block
265
+ class="prose prose-sm prose-zinc max-w-none"
266
+ />
267
+ </template>
268
+
269
+ <form
270
+ class="flex flex-col gap-2 py-2"
271
+ @submit.prevent="onSubmit"
272
+ >
273
+ <Textarea
274
+ v-model="context"
275
+ placeholder="任意上下文,建议包含:&#10;- 接口路径与方法(如 GET /api/users)&#10;- 查询参数与分页约定(page 是否从 1 开始?)&#10;- 示例响应(JSON),尤其是数据列表与总数字段名"
276
+ wrap="soft"
277
+ class="field-sizing-fixed h-72 max-h-[60vh] resize-none overflow-auto break-all whitespace-pre-wrap font-mono text-xs"
278
+ :disabled="submitting"
279
+ />
280
+ </form>
287
281
 
288
- <template #footer>
289
- <div class="flex items-center gap-2">
290
- <div
291
- v-if="submitting"
292
- class="mr-auto flex items-center gap-2 text-xs text-muted-foreground"
293
- aria-live="polite"
294
- >
295
- <span
296
- :key="tick"
297
- class="ai-progress-dot"
298
- :class="tick > 0 ? 'is-streaming' : 'is-waiting'"
299
- />
300
- <span>{{ tick > 0 ? "\u6B63\u5728\u63A5\u6536\u6A21\u578B\u8F93\u51FA\u2026" : "\u6B63\u5728\u8BF7\u6C42\u6A21\u578B\u2026" }}</span>
301
- </div>
302
- <Button
303
- type="button"
304
- size="sm"
305
- :disabled="submitting"
306
- @click="open = false"
307
- >
308
- <Icon icon="fluent:dismiss-20-regular" />
309
- 取消
310
- </Button>
311
- <Button
312
- type="button"
313
- variant="primary"
314
- size="sm"
315
- :disabled="!canSubmit"
316
- @click="onSubmit"
317
- >
318
- <Icon
319
- :icon="submitting ? 'fluent:arrow-sync-20-regular' : 'fluent:sparkle-20-regular'"
320
- :class="submitting ? 'animate-spin' : ''"
321
- />
322
- 生成
323
- </Button>
282
+ <template #footer>
283
+ <div class="flex items-center gap-2">
284
+ <div
285
+ v-if="submitting"
286
+ class="mr-auto flex items-center gap-2 text-xs text-muted-foreground"
287
+ aria-live="polite"
288
+ >
289
+ <span
290
+ :key="tick"
291
+ class="ai-progress-dot"
292
+ :class="tick > 0 ? 'is-streaming' : 'is-waiting'"
293
+ />
294
+ <span>{{ tick > 0 ? "\u6B63\u5728\u63A5\u6536\u6A21\u578B\u8F93\u51FA\u2026" : "\u6B63\u5728\u8BF7\u6C42\u6A21\u578B\u2026" }}</span>
324
295
  </div>
325
- </template>
326
- </ShwfedModal>
327
- </template>
296
+ <Button
297
+ type="button"
298
+ size="sm"
299
+ :disabled="submitting"
300
+ @click="open = false"
301
+ >
302
+ <Icon icon="fluent:dismiss-20-regular" />
303
+ 取消
304
+ </Button>
305
+ <Button
306
+ type="button"
307
+ variant="primary"
308
+ size="sm"
309
+ :disabled="!canSubmit"
310
+ @click="onSubmit"
311
+ >
312
+ <Icon
313
+ :icon="submitting ? 'fluent:arrow-sync-20-regular' : 'fluent:sparkle-20-regular'"
314
+ :class="submitting ? 'animate-spin' : ''"
315
+ />
316
+ 生成
317
+ </Button>
318
+ </div>
319
+ </template>
320
+ </ShwfedModal>
328
321
  </template>
329
322
 
330
323
  <style scoped>
@@ -511,13 +511,11 @@ export { TableConfig, createTableConfig, getColumnTechnicalKey } from "./schema"
511
511
  v-if="config?.query"
512
512
  class="w-full py-1.5"
513
513
  >
514
- <ClientOnly>
515
- <ShwfedForm
516
- ref="queryRef"
517
- v-model="queryState"
518
- :config="config.query"
519
- />
520
- </ClientOnly>
514
+ <ShwfedForm
515
+ ref="queryRef"
516
+ v-model="queryState"
517
+ :config="config.query"
518
+ />
521
519
  </div>
522
520
  <nav
523
521
  v-if="tableActionsConfig"
@@ -1,6 +1,5 @@
1
- import { type ComputedRef, type Ref } from 'vue';
1
+ import { type ComputedRef } from 'vue';
2
2
  import { Schema } from 'effect';
3
- import { type AiConfig } from './store.js';
4
3
  export interface GenerateTextInput {
5
4
  readonly prompt: string;
6
5
  readonly system?: string;
@@ -30,9 +29,6 @@ export interface GenerateObjectInput<A, I extends Record<string, unknown>> {
30
29
  }
31
30
  export interface Ai {
32
31
  readonly available: ComputedRef<boolean>;
33
- readonly config: Ref<AiConfig | null>;
34
- readonly setConfig: (next: AiConfig | null) => void;
35
- readonly openSettings: () => void;
36
32
  readonly generateText: (input: GenerateTextInput) => Promise<string>;
37
33
  readonly generateObject: <A, I extends Record<string, unknown>>(input: GenerateObjectInput<A, I>) => Promise<A>;
38
34
  }