@shwfed/nuxt 0.1.16 → 0.1.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.16",
4
+ "version": "0.1.18",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -18,7 +18,6 @@ const module$1 = defineNuxtModule({
18
18
  prefix: "shwfed",
19
19
  extensions: ["vue"]
20
20
  });
21
- nuxt.options.typescript.tsConfig.include?.push(resolver.resolve("runtime/types/directive.d.ts"));
22
21
  }
23
22
  });
24
23
 
@@ -1,5 +1,13 @@
1
1
  <script setup>
2
+ import { useHead } from "#app";
2
3
  import { Tooltip } from "reka-ui/namespaced";
4
+ useHead({
5
+ bodyAttrs: {
6
+ style: {
7
+ "--primary": "#2DA8BC"
8
+ }
9
+ }
10
+ });
3
11
  </script>
4
12
 
5
13
  <template>
@@ -1,5 +1,10 @@
1
1
  import type { RowData, TableOptions } from '@tanstack/vue-table';
2
2
  export type Expression = string;
3
+ export type Markdown = string;
4
+ export type Render = string | Readonly<{
5
+ id: string;
6
+ props: unknown;
7
+ }>;
3
8
  export type Accessor = string | Readonly<{
4
9
  read: Expression;
5
10
  write: Expression;
@@ -9,10 +14,7 @@ export type Column = Readonly<{
9
14
  title?: string;
10
15
  accessor?: Accessor;
11
16
  accessorKey?: string;
12
- renderer?: string | Readonly<{
13
- id: string;
14
- props: unknown;
15
- }>;
17
+ renderer?: Render;
16
18
  tooltip?: string;
17
19
  size?: number;
18
20
  enableSorting?: boolean;
@@ -40,6 +42,8 @@ declare const __VLS_export: import("vue").DefineComponent<Readonly<{
40
42
  data: Array<unknown>;
41
43
  cellStyles?: Expression;
42
44
  props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
45
+ paginationLeft?: Markdown;
46
+ paginationRight?: Markdown;
43
47
  }>, import("@tanstack/vue-table").Table<unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Readonly<{
44
48
  id: string;
45
49
  getRowId?: Expression;
@@ -50,6 +54,8 @@ declare const __VLS_export: import("vue").DefineComponent<Readonly<{
50
54
  data: Array<unknown>;
51
55
  cellStyles?: Expression;
52
56
  props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
57
+ paginationLeft?: Markdown;
58
+ paginationRight?: Markdown;
53
59
  }>> & Readonly<{}>, {
54
60
  readonly props: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
55
61
  readonly getRowId: Expression;
@@ -6,7 +6,6 @@ import { getProperty } from "dot-prop";
6
6
  import { Pagination } from "reka-ui/namespaced";
7
7
  import { computed, ref } from "vue";
8
8
  import { useNuxtApp } from "#app";
9
- import { useCheating } from "../composables/useCheating";
10
9
  import { useTableRenderers } from "../composables/useTableRenderers";
11
10
  import Tooltip from "./tooltip.vue";
12
11
  </script>
@@ -21,15 +20,13 @@ const props = defineProps({
21
20
  columns: { type: Array, required: true },
22
21
  data: { type: Array, required: true },
23
22
  cellStyles: { type: String, required: false, default: void 0 },
24
- props: { type: Object, required: false, default: void 0 }
23
+ props: { type: Object, required: false, default: void 0 },
24
+ paginationLeft: { type: String, required: false },
25
+ paginationRight: { type: String, required: false }
25
26
  });
26
- const isCheating = useCheating();
27
- const { $dsl, $markdown } = useNuxtApp();
27
+ const { $dsl } = useNuxtApp();
28
28
  const { resolveTableRenderer } = useTableRenderers();
29
29
  const containerRef = ref(null);
30
- function renderInline(source) {
31
- return $markdown.renderInline(source);
32
- }
33
30
  function genColumnId(column) {
34
31
  if (typeof column.accessor === "string") {
35
32
  return column.accessor;
@@ -39,29 +36,10 @@ function genColumnId(column) {
39
36
  return crypto.randomUUID();
40
37
  }
41
38
  function translate(column) {
42
- const rendererId = typeof column.renderer === "string" ? column.renderer : column.renderer?.id ? column.renderer.id : "table.renderer.text";
43
- const rendererProps = column.renderer && typeof column.renderer === "object" && "props" in column.renderer ? column.renderer.props : null;
44
- const renderer = resolveTableRenderer(rendererId);
45
- const options = renderer.parseOptions(rendererProps);
46
- const helpers = {
47
- renderInline,
48
- evaluate: $dsl.evaluate
49
- };
50
- const header = (ctx) => {
51
- if (renderer.header) {
52
- return renderer.header({
53
- ctx,
54
- title: typeof column.title === "string" ? column.title : void 0,
55
- options,
56
- helpers
57
- });
58
- }
59
- return typeof column.title === "string" ? column.title : void 0;
60
- };
61
39
  if (Array.isArray(column.columns) && column.columns.length > 0) {
62
40
  return {
63
41
  id: column.id ?? genColumnId(column),
64
- header,
42
+ header: column.title,
65
43
  columns: column.columns?.map((column2) => translate(column2)) ?? [],
66
44
  enableSorting: column.enableSorting ?? false,
67
45
  enableMultiSort: column.enableMultiSorting,
@@ -73,13 +51,14 @@ function translate(column) {
73
51
  }
74
52
  };
75
53
  }
76
- const cell = (ctx) => {
77
- return renderer.cell({ ctx, options, helpers });
78
- };
54
+ const renderer = resolveTableRenderer(typeof column.renderer === "string" ? column.renderer : column.renderer?.id ? column.renderer.id : "table.renderer.text");
55
+ const options = renderer.parseOptions(column.renderer && typeof column.renderer === "object" && "props" in column.renderer ? column.renderer.props : null);
79
56
  return {
80
57
  id: column.id ?? genColumnId(column),
81
- header,
82
- cell,
58
+ header: (ctx) => renderer.header?.({ ctx, options }) ?? column.title,
59
+ cell: (ctx) => {
60
+ return renderer.cell({ ctx, options });
61
+ },
83
62
  accessorFn: (row, index) => {
84
63
  const key = column.accessorKey ? column.accessorKey : column.accessor;
85
64
  if (typeof key === "string") {
@@ -224,15 +203,24 @@ function getCellStyles(ctx) {
224
203
  return {};
225
204
  }
226
205
  }
227
- function hasAdjacentColumns(column) {
206
+ function shouldHaveRightBorder(column) {
228
207
  switch (column.getIsPinned()) {
229
208
  case "left":
230
- return !column.getIsLastColumn("left");
231
- // why would anyone pin all columns to the left?
209
+ return true;
232
210
  case "right":
233
211
  return !column.getIsLastColumn("right");
234
212
  case false:
235
- return !column.getIsLastColumn("center") || table.getIsSomeColumnsPinned("right");
213
+ return !column.getIsLastColumn("center");
214
+ }
215
+ }
216
+ function shouldHaveLeftBorder(column) {
217
+ switch (column.getIsPinned()) {
218
+ case "left":
219
+ return false;
220
+ case "right":
221
+ return true;
222
+ case false:
223
+ return false;
236
224
  }
237
225
  }
238
226
  function pinnedStyle(column) {
@@ -263,11 +251,10 @@ function getSortIcon(column) {
263
251
  <template>
264
252
  <div
265
253
  class="flex flex-col h-full"
266
- :style="isCheating ? { '--primary': '#BC1111' } : { '--primary': '#2DA8BC' }"
267
254
  >
268
255
  <div
269
256
  ref="containerRef"
270
- class="overflow-scroll flex-1 border border-zinc-200 rounded relative"
257
+ class="overflow-scroll overscroll-none flex-1 border border-zinc-200 rounded relative"
271
258
  >
272
259
  <div :style="{ height: `${rowTotalSize}px` }">
273
260
  <table class="grid">
@@ -287,7 +274,8 @@ function getSortIcon(column) {
287
274
  'text-xs flex items-center justify-center relative',
288
275
  'bg-[color-mix(in_srgb,var(--primary)_10%,white)] group',
289
276
  header.column.getIsPinned() && 'sticky z-15',
290
- (header.column.getIsPinned() === 'left' || hasAdjacentColumns(header.column)) && 'border-r'
277
+ shouldHaveRightBorder(header.column) && 'border-r',
278
+ shouldHaveLeftBorder(header.column) && 'border-l'
291
279
  ]"
292
280
  :style="{
293
281
  width: `${header.getSize()}px`,
@@ -303,7 +291,7 @@ function getSortIcon(column) {
303
291
  <Tooltip
304
292
  v-if="!header.isPlaceholder && header.column.columnDef.meta?.tooltip"
305
293
  :delay-duration="180"
306
- :content="renderInline(header.column.columnDef.meta.tooltip)"
294
+ :content="$md.inline`${header.column.columnDef.meta.tooltip}`"
307
295
  >
308
296
  <Icon icon="fluent:info-20-regular" />
309
297
  </Tooltip>
@@ -354,7 +342,7 @@ function getSortIcon(column) {
354
342
  v-for="r in rowWindow"
355
343
  :key="rows[r.index]?.id ?? r.index"
356
344
  :ref="measureRow"
357
- class="flex absolute w-full"
345
+ class="flex absolute w-full not-last:border-b border-zinc-300"
358
346
  :data-index="rows[r.index]?.index"
359
347
  :style="{ transform: `translate3d(0, ${r.start}px, 0)` }"
360
348
  >
@@ -362,10 +350,11 @@ function getSortIcon(column) {
362
350
  v-for="cell in rows[r.index]?.getVisibleCells() ?? []"
363
351
  :key="cell.id"
364
352
  :class="[
365
- 'border-b border-zinc-300',
353
+ 'border-zinc-300',
366
354
  cell.column.columnDef.meta?.grow && 'flex-1',
367
355
  cell.column.getIsPinned() && 'sticky z-15',
368
- (cell.column.getIsPinned() === 'left' || hasAdjacentColumns(cell.column)) && 'border-r'
356
+ shouldHaveRightBorder(cell.column) && 'border-r',
357
+ shouldHaveLeftBorder(cell.column) && 'border-l'
369
358
  ]"
370
359
  :style="{
371
360
  width: `${cell.column.getSize()}px`,
@@ -380,12 +369,47 @@ function getSortIcon(column) {
380
369
  </td>
381
370
  </tr>
382
371
  </tbody>
372
+
373
+ <tfoot class="hidden has-[[data-footer]]:grid sticky bottom-0 z-10 select-none border-t border-zinc-200">
374
+ <tr
375
+ v-for="group in table.getFooterGroups()"
376
+ :key="group.id"
377
+ class="flex w-full border-zinc-200"
378
+ >
379
+ <th
380
+ v-for="header in group.headers"
381
+ :key="header.id"
382
+ :colSpan="header.colSpan"
383
+ :class="[
384
+ header.column.columnDef.meta?.grow && 'flex-1',
385
+ 'flex items-center gap-2 border-zinc-300 text-zinc-600 p-0',
386
+ 'text-xs flex items-center justify-center relative',
387
+ 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] group',
388
+ header.column.getIsPinned() && 'sticky z-15',
389
+ shouldHaveRightBorder(header.column) && 'border-r',
390
+ shouldHaveLeftBorder(header.column) && 'border-l'
391
+ ]"
392
+ :style="{
393
+ width: `${header.getSize()}px`,
394
+ ...pinnedStyle(header.column)
395
+ }"
396
+ >
397
+ <FlexRender
398
+ v-if="!header.isPlaceholder"
399
+ :render="header.column.columnDef.footer"
400
+ :props="header.getContext()"
401
+ />
402
+ </th>
403
+ </tr>
404
+ </tfoot>
383
405
  </table>
384
406
  </div>
385
407
  </div>
386
408
 
387
409
  <div class="flex items-center justify-between w-full p-4 text-sm text-zinc-600">
388
- <div />
410
+ <div>
411
+ <div />
412
+ </div>
389
413
  <div class="flex items-center gap-4">
390
414
  <span class="text-xs">{{ `\u5171 ${props.data.length} \u6761` }}</span>
391
415
  <Pagination.Root
@@ -1,5 +1,10 @@
1
1
  import type { RowData, TableOptions } from '@tanstack/vue-table';
2
2
  export type Expression = string;
3
+ export type Markdown = string;
4
+ export type Render = string | Readonly<{
5
+ id: string;
6
+ props: unknown;
7
+ }>;
3
8
  export type Accessor = string | Readonly<{
4
9
  read: Expression;
5
10
  write: Expression;
@@ -9,10 +14,7 @@ export type Column = Readonly<{
9
14
  title?: string;
10
15
  accessor?: Accessor;
11
16
  accessorKey?: string;
12
- renderer?: string | Readonly<{
13
- id: string;
14
- props: unknown;
15
- }>;
17
+ renderer?: Render;
16
18
  tooltip?: string;
17
19
  size?: number;
18
20
  enableSorting?: boolean;
@@ -40,6 +42,8 @@ declare const __VLS_export: import("vue").DefineComponent<Readonly<{
40
42
  data: Array<unknown>;
41
43
  cellStyles?: Expression;
42
44
  props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
45
+ paginationLeft?: Markdown;
46
+ paginationRight?: Markdown;
43
47
  }>, import("@tanstack/vue-table").Table<unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Readonly<{
44
48
  id: string;
45
49
  getRowId?: Expression;
@@ -50,6 +54,8 @@ declare const __VLS_export: import("vue").DefineComponent<Readonly<{
50
54
  data: Array<unknown>;
51
55
  cellStyles?: Expression;
52
56
  props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
57
+ paginationLeft?: Markdown;
58
+ paginationRight?: Markdown;
53
59
  }>> & Readonly<{}>, {
54
60
  readonly props: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
55
61
  readonly getRowId: Expression;
@@ -1,7 +1,7 @@
1
1
  import '../table-renderers/builtins.js';
2
2
  import { getTableRenderer, resolveTableRenderer } from '../table-renderers/registry.js';
3
3
  export { defineTableRenderer } from '../table-renderers/registry.js';
4
- export type { TableRenderer, TableRendererCellArgs, TableRendererColumnDefOverrides, TableRendererConfigComponent, TableRendererHeaderArgs, TableRendererId, } from '../table-renderers/registry.js';
4
+ export type { TableRenderer, TableRendererCellArgs, TableRendererColumnDefOverrides, TableRendererConfigComponent, TableRendererFooterArgs, TableRendererHeaderArgs, TableRendererId, } from '../table-renderers/registry.js';
5
5
  export declare function useTableRenderers(): {
6
6
  getTableRenderer: typeof getTableRenderer;
7
7
  resolveTableRenderer: typeof resolveTableRenderer;
@@ -1,25 +1,28 @@
1
1
  import { defineNuxtPlugin } from "#app";
2
2
  import defu from "defu";
3
3
  import { createEnvironment } from "./env.js";
4
- export default defineNuxtPlugin(() => {
5
- const env = createEnvironment();
6
- return {
7
- provide: {
8
- dsl: {
9
- check: (source) => {
10
- return env.check(source);
11
- },
12
- /**
13
- * Synchronous evaluation for render-time usage (e.g. table accessors).
14
- *
15
- * Will throw `TypeError` / `EvaluationError` on failure.
16
- */
17
- evaluate: (source, context) => {
18
- return env.evaluate(source, defu(context, {
19
- now: /* @__PURE__ */ new Date()
20
- }));
4
+ export default defineNuxtPlugin({
5
+ name: "shwfed-nuxt:cel",
6
+ setup: () => {
7
+ const env = createEnvironment();
8
+ return {
9
+ provide: {
10
+ dsl: {
11
+ check: (source) => {
12
+ return env.check(source);
13
+ },
14
+ /**
15
+ * Synchronous evaluation for render-time usage (e.g. table accessors).
16
+ *
17
+ * Will throw `TypeError` / `EvaluationError` on failure.
18
+ */
19
+ evaluate: (source, context) => {
20
+ return env.evaluate(source, defu(context, {
21
+ now: /* @__PURE__ */ new Date()
22
+ }));
23
+ }
21
24
  }
22
25
  }
23
- }
24
- };
26
+ };
27
+ }
25
28
  });
@@ -1,15 +1,23 @@
1
1
  import { md } from './md.js';
2
2
  declare const _default: import("#app").Plugin<{
3
- md: typeof md;
4
- markdown: {
5
- render: (source: string) => string;
6
- renderInline: (source: string) => string;
3
+ md: {
4
+ raw: typeof md;
5
+ inline: (template: {
6
+ raw: readonly string[] | ArrayLike<string>;
7
+ }, ...substitutions: any[]) => string;
8
+ block: (template: {
9
+ raw: readonly string[] | ArrayLike<string>;
10
+ }, ...substitutions: any[]) => string;
7
11
  };
8
12
  }> & import("#app").ObjectPlugin<{
9
- md: typeof md;
10
- markdown: {
11
- render: (source: string) => string;
12
- renderInline: (source: string) => string;
13
+ md: {
14
+ raw: typeof md;
15
+ inline: (template: {
16
+ raw: readonly string[] | ArrayLike<string>;
17
+ }, ...substitutions: any[]) => string;
18
+ block: (template: {
19
+ raw: readonly string[] | ArrayLike<string>;
20
+ }, ...substitutions: any[]) => string;
13
21
  };
14
22
  }>;
15
23
  export default _default;
@@ -1,33 +1,34 @@
1
- import { defineNuxtPlugin } from "#app";
1
+ import { defineNuxtPlugin, useNuxtApp } from "#app";
2
2
  import MarkdownIt from "markdown-it";
3
3
  import { md } from "./md.js";
4
- export default defineNuxtPlugin((app) => {
5
- const engine = new MarkdownIt("commonmark", {
6
- html: true
7
- });
8
- app.vueApp.directive("md", {
9
- beforeMount(el, v) {
10
- if (["inline", "inline-flex", "inline-block"].includes(getComputedStyle(el).display)) {
11
- el.innerHTML = engine.renderInline(v.value);
12
- } else {
13
- el.innerHTML = engine.render(v.value);
14
- }
15
- },
16
- beforeUpdate(el, v) {
17
- if (["inline", "inline-flex", "inline-block"].includes(getComputedStyle(el).display)) {
18
- el.innerHTML = engine.renderInline(v.value);
19
- } else {
20
- el.innerHTML = engine.render(v.value);
21
- }
4
+ export default defineNuxtPlugin({
5
+ name: "shwfed-nuxt:markdown",
6
+ dependsOn: ["shwfed-nuxt:cel"],
7
+ setup: () => {
8
+ const engine = new MarkdownIt("commonmark", {
9
+ html: true
10
+ });
11
+ const { $dsl } = useNuxtApp();
12
+ function evaluateBlock(source) {
13
+ return source.replace(/\{\{([\s\S]+?)\}\}/g, (_, expression) => {
14
+ if (!expression)
15
+ return "";
16
+ try {
17
+ return $dsl.evaluate(expression);
18
+ } catch (e) {
19
+ console.error(e);
20
+ return "";
21
+ }
22
+ });
22
23
  }
23
- });
24
- return {
25
- provide: {
26
- md,
27
- markdown: {
28
- render: (source) => engine.render(source),
29
- renderInline: (source) => engine.renderInline(source)
24
+ return {
25
+ provide: {
26
+ md: {
27
+ raw: md,
28
+ inline: (...args) => engine.renderInline(evaluateBlock(md(...args))),
29
+ block: (...args) => engine.render(evaluateBlock(md(...args)))
30
+ }
30
31
  }
31
- }
32
- };
32
+ };
33
+ }
33
34
  });
@@ -4,6 +4,7 @@ import { format as formatDate, isValid, toDate } from "date-fns";
4
4
  import { defineComponent } from "vue";
5
5
  import { z } from "zod";
6
6
  import { defineTableRenderer } from "./registry.js";
7
+ import { useNuxtApp } from "#app";
7
8
  const JUSTIFY_CLASS = {
8
9
  left: "justify-start",
9
10
  center: "justify-center",
@@ -185,16 +186,17 @@ defineTableRenderer(
185
186
  align: z.enum(["left", "center", "right"]).default("left")
186
187
  },
187
188
  {
188
- cell: ({ ctx, options, helpers }) => {
189
+ cell: ({ ctx, options }) => {
189
190
  const rawValue = ctx.cell.getValue();
190
191
  const isEmpty = rawValue === void 0 || rawValue === null;
191
192
  const align = isEmpty ? "center" : options.align ?? "left";
192
193
  const justifyClass = JUSTIFY_CLASS[align];
194
+ const { $dsl } = useNuxtApp();
193
195
  const onCopy = async () => {
194
196
  try {
195
197
  let text = String(ctx.cell.getValue());
196
- if (options.copyExpression && helpers.evaluate) {
197
- text = String(helpers.evaluate(options.copyExpression, {
198
+ if (options.copyExpression) {
199
+ text = String($dsl.evaluate(options.copyExpression, {
198
200
  row: ctx.row.original,
199
201
  index: BigInt(ctx.row.index)
200
202
  }));
@@ -287,7 +289,7 @@ defineTableRenderer(
287
289
  type: "checkbox",
288
290
  checked,
289
291
  class: [
290
- "peer h-4 w-4 cursor-pointer transition-colors duration-180 appearance-none rounded",
292
+ "peer h-4 w-4 cursor-pointer transition-colors duration-180 appearance-none rounded bg-white",
291
293
  "border border-[color-mix(in_srgb,var(--primary)_10%,#00000033)] not-checked-group-hover:border-[color-mix(in_srgb,var(--primary)_20%,#00000033)]",
292
294
  "not-checked-group-hover:bg-[color-mix(in_srgb,var(--primary)_5%,#00000011)] checked:border-[var(--primary)] checked:bg-[var(--primary)]"
293
295
  ],
@@ -333,7 +335,10 @@ defineTableRenderer(
333
335
  children: /* @__PURE__ */ jsx(Icon, { icon: ctx.table.getIsAllRowsExpanded() ? "fluent:subtract-square-20-regular" : "fluent:add-square-20-regular" })
334
336
  }
335
337
  ) }),
336
- config: NoOptionsConfig
338
+ config: NoOptionsConfig,
339
+ columnDefOverrides: {
340
+ enableResizing: false
341
+ }
337
342
  }
338
343
  );
339
344
  defineTableRenderer(
@@ -394,10 +399,10 @@ defineTableRenderer(
394
399
  source: z.string().optional()
395
400
  },
396
401
  {
397
- cell: ({ ctx, options, helpers }) => {
402
+ cell: ({ ctx, options }) => {
403
+ const { $md } = useNuxtApp();
398
404
  const source = options.source ?? String(ctx.cell.getValue());
399
- const html = helpers.renderInline(source);
400
- return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx("span", { class: "prose prose-zinc text-xs", innerHTML: html }) });
405
+ return /* @__PURE__ */ jsx("div", { class: "relative w-full py-2 px-1 flex items-center justify-center text-xs", children: /* @__PURE__ */ jsx("span", { class: "prose prose-zinc text-xs", innerHTML: $md.inline`${source}` }) });
401
406
  },
402
407
  config: TableRendererMarkdownConfig
403
408
  }
@@ -6,19 +6,14 @@ export type TableRendererColumnDefOverrides<TData extends RowData = unknown> = P
6
6
  export type TableRendererCellArgs<TData extends RowData, TValue, TOptions> = Readonly<{
7
7
  ctx: CellContext<TData, TValue>;
8
8
  options: TOptions;
9
- helpers: Readonly<{
10
- renderInline: (source: string) => string;
11
- evaluate?: (source: string, context?: Record<string, unknown>) => unknown;
12
- }>;
13
9
  }>;
14
10
  export type TableRendererHeaderArgs<TData extends RowData, TValue, TOptions> = Readonly<{
15
11
  ctx: HeaderContext<TData, TValue>;
16
- title?: string;
17
12
  options: TOptions;
18
- helpers: Readonly<{
19
- renderInline: (source: string) => string;
20
- evaluate?: (source: string, context?: Record<string, unknown>) => unknown;
21
- }>;
13
+ }>;
14
+ export type TableRendererFooterArgs<TData extends RowData, TValue, TOptions> = Readonly<{
15
+ ctx: HeaderContext<TData, TValue>;
16
+ options: TOptions;
22
17
  }>;
23
18
  export type TableRendererConfigComponent<_TOptions> = unknown;
24
19
  export type TableRenderer<TOptions> = Readonly<{
@@ -27,12 +22,14 @@ export type TableRenderer<TOptions> = Readonly<{
27
22
  parseOptions: (input: unknown) => TOptions;
28
23
  cell: (args: TableRendererCellArgs<unknown, unknown, TOptions>) => VNodeChild;
29
24
  header?: (args: TableRendererHeaderArgs<unknown, unknown, TOptions>) => VNodeChild;
25
+ footer?: (args: TableRendererFooterArgs<unknown, unknown, TOptions>) => VNodeChild;
30
26
  config?: TableRendererConfigComponent<TOptions>;
31
27
  columnDefOverrides?: TableRendererColumnDefOverrides;
32
28
  }>;
33
29
  export declare function defineTableRenderer<const TShape extends z.ZodRawShape, const TOptions = z.infer<z.ZodObject<TShape>>>(id: TableRendererId, shape: TShape, impl: Readonly<{
34
30
  cell: TableRenderer<TOptions>['cell'];
35
31
  header?: TableRenderer<TOptions>['header'];
32
+ footer?: TableRenderer<TOptions>['footer'];
36
33
  config?: TableRenderer<TOptions>['config'];
37
34
  columnDefOverrides?: TableRenderer<TOptions>['columnDefOverrides'];
38
35
  }>): TableRenderer<TOptions>;
@@ -6,11 +6,12 @@ export function defineTableRenderer(id, shape, impl) {
6
6
  id,
7
7
  optionsSchema,
8
8
  parseOptions: (input) => {
9
- const normalized = input == null ? {} : input;
9
+ const normalized = input === null || input === void 0 ? {} : input;
10
10
  return optionsSchema.parse(normalized);
11
11
  },
12
12
  cell: impl.cell,
13
13
  header: impl.header,
14
+ footer: impl.footer,
14
15
  config: impl.config,
15
16
  columnDefOverrides: impl.columnDefOverrides
16
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,9 +0,0 @@
1
- import type { Directive } from 'vue'
2
-
3
- export type MdDirective = Directive<HTMLElement, string>
4
-
5
- declare module 'vue' {
6
- export interface ComponentCustomProperties {
7
- vMd: MdDirective
8
- }
9
- }