@gopowerteam/table-render 0.0.3 → 0.0.5

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.
@@ -1,2 +1,3 @@
1
- import type { DataRecord, TableColumnsOptions } from '../interfaces';
2
- export declare function defineColumns<T = DataRecord>(columns: TableColumnsOptions<T>): TableColumnsOptions<T>;
1
+ import type { DataRecord, TableColumnsOptions, TableColumnsStringKeyOptions, TableColumnsTypeKeyOptions } from '../interfaces';
2
+ export declare function defineColumns<T = DataRecord>(columns: TableColumnsTypeKeyOptions<T>): TableColumnsOptions<T>;
3
+ export declare function defineColumns<T = DataRecord>(columns: TableColumnsStringKeyOptions<T>): TableColumnsOptions<T>;
@@ -1,4 +1,6 @@
1
- export * from './table-render/index';
1
+ export * from './table-render';
2
2
  export * from './interfaces';
3
3
  export * from './hooks';
4
4
  export * from './defines';
5
+ export * from './resolver';
6
+ export { default } from './install';
package/dist/es/index.mjs CHANGED
@@ -6,6 +6,7 @@ import { Button as Ye, Tag as Ar, Descriptions as Rr, DescriptionsItem as Or, Di
6
6
  import { useModal as fr, ModalProvider as Pr } from "@gopowerteam/modal-render";
7
7
  import Br from "dayjs";
8
8
  import { FormRender as dr } from "@gopowerteam/form-render";
9
+ import { TableRenderResolver as ni } from "./resolver.mjs";
9
10
  function Dr(X, at, s) {
10
11
  const [C, ..._] = (at.index || at.key).split(".").reverse(), p = _.reverse().reduce((o, a) => o == null ? void 0 : o[a], X);
11
12
  p[C] = s;
@@ -28,7 +29,7 @@ function Lr(X) {
28
29
  ...typeof at.form == "boolean" ? {} : at.form
29
30
  }));
30
31
  }
31
- function Zn(X) {
32
+ function Gn(X) {
32
33
  const at = Ze(), s = Te();
33
34
  function C() {
34
35
  var p, o;
@@ -34069,7 +34070,7 @@ const $n = /* @__PURE__ */ Be({
34069
34070
  function Hn(X) {
34070
34071
  return !!X && (typeof X == "object" || typeof X == "function") && typeof X.then == "function";
34071
34072
  }
34072
- const Gn = /* @__PURE__ */ Be({
34073
+ const Vn = /* @__PURE__ */ Be({
34073
34074
  props: {
34074
34075
  // 数据主键
34075
34076
  rowKey: {
@@ -34089,7 +34090,7 @@ const Gn = /* @__PURE__ */ Be({
34089
34090
  required: !1,
34090
34091
  default: !0
34091
34092
  },
34092
- loadData: {
34093
+ dataLoad: {
34093
34094
  type: Function,
34094
34095
  required: !1
34095
34096
  },
@@ -34219,7 +34220,7 @@ const Gn = /* @__PURE__ */ Be({
34219
34220
  });
34220
34221
  }, d = (v) => {
34221
34222
  var g;
34222
- if (!X.loadData)
34223
+ if (!X.dataLoad)
34223
34224
  return;
34224
34225
  v != null && v.reset && (e && e.reset(), l && l.reset());
34225
34226
  const m = {
@@ -34228,7 +34229,7 @@ const Gn = /* @__PURE__ */ Be({
34228
34229
  Object.keys(m).forEach((y) => {
34229
34230
  [null, void 0, ""].includes(m[y]) && delete m[y];
34230
34231
  });
34231
- const b = X.loadData({
34232
+ const b = X.dataLoad({
34232
34233
  form: m,
34233
34234
  page: e,
34234
34235
  sort: l,
@@ -34329,10 +34330,17 @@ function Jn(X) {
34329
34330
  function Qn(X) {
34330
34331
  return X;
34331
34332
  }
34333
+ const ti = {
34334
+ install(X, at) {
34335
+ X.component("TableRender", Vn);
34336
+ }
34337
+ };
34332
34338
  export {
34333
- Gn as TableRender,
34339
+ Vn as TableRender,
34340
+ ni as TableRenderResolver,
34341
+ ti as default,
34334
34342
  Jn as defineColumns,
34335
34343
  Qn as defineTableLoad,
34336
34344
  zr as useEvents,
34337
- Zn as useTable
34345
+ Gn as useTable
34338
34346
  };
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vue';
2
+ declare const _default: Plugin;
3
+ export default _default;
@@ -2,6 +2,7 @@ export * from './table-column-render';
2
2
  export * from './table-column-options';
3
3
  export * from './table-load-params';
4
4
  export * from './sortable-options';
5
+ export * from './pageable-options';
5
6
  export interface DataRecord {
6
7
  [key: string]: any;
7
8
  }
@@ -14,7 +14,7 @@ export interface TableColumnSharedOptions {
14
14
  * 列配置
15
15
  */
16
16
  export interface TableColumnOptions<T> {
17
- key: string;
17
+ key: string | keyof T;
18
18
  title: string;
19
19
  index?: string;
20
20
  fixed?: 'left' | 'right';
@@ -31,10 +31,18 @@ export interface TableColumnOptions<T> {
31
31
  visiable?: boolean | (() => boolean);
32
32
  extraProps?: Partial<Omit<TableColumnData, 'dataIndex' | 'title' | 'fixed' | 'align' | 'width'>>;
33
33
  }
34
+ export interface TableColumnTypeKeyOptions<T> extends TableColumnOptions<T> {
35
+ key: keyof T;
36
+ }
37
+ export interface TableColumnStringKeyOptions<T> extends TableColumnOptions<T> {
38
+ key: string;
39
+ }
34
40
  export interface ExportColumnOptions {
35
41
  header?: string;
36
42
  width?: number;
37
43
  content?: (record: DataRecord) => string | number | undefined;
38
44
  }
39
45
  export type TableColumnsOptions<T = DataRecord> = TableColumnOptions<T>[];
46
+ export type TableColumnsTypeKeyOptions<T = DataRecord> = TableColumnTypeKeyOptions<T>[];
47
+ export type TableColumnsStringKeyOptions<T = DataRecord> = TableColumnStringKeyOptions<T>[];
40
48
  export type DataFormatter<T> = (record: T) => string | number | Date | undefined;
@@ -0,0 +1,8 @@
1
+ export declare function TableRenderResolver(): {
2
+ type: "component";
3
+ resolve: (name: string) => {
4
+ name: string;
5
+ from: string;
6
+ sideEffects: string[];
7
+ } | undefined;
8
+ };
@@ -0,0 +1,17 @@
1
+ function t() {
2
+ return {
3
+ type: "component",
4
+ resolve: (e) => {
5
+ const r = "@gopowerteam/table-render";
6
+ if (e === "TableRender" || e === "table-render")
7
+ return {
8
+ name: "TableRender",
9
+ from: r,
10
+ sideEffects: [`${r}/dist/style.css`]
11
+ };
12
+ }
13
+ };
14
+ }
15
+ export {
16
+ t as TableRenderResolver
17
+ };