@funcho/ui 1.1.33 → 1.1.34

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.
@@ -98,6 +98,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
98
98
  columns: { default: () => [] },
99
99
  isPagination: { type: Boolean, default: true },
100
100
  fields: { default: () => [] },
101
+ data: { default: void 0 },
101
102
  request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
102
103
  actions: { default: () => [] },
103
104
  actionsWidth: { default: 0 },
@@ -106,6 +107,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
106
107
  setup(__props, { expose: __expose }) {
107
108
  const ns = useNamespace.useNamespace("data-table");
108
109
  const props = __props;
110
+ const showPagination = vue.computed(() => {
111
+ if (!props.isPagination) return false;
112
+ if (props.data !== void 0) return false;
113
+ return true;
114
+ });
109
115
  const renderActions = (actions, row, index) => {
110
116
  return vue.h(
111
117
  "div",
@@ -147,6 +153,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
147
153
  return (pagination.value.currentPage - 1) * pagination.value.pageSize + i + 1;
148
154
  };
149
155
  const tableData = vue.ref([]);
156
+ const displayData = vue.computed(() => {
157
+ if (props.data !== void 0) {
158
+ return props.data || [];
159
+ }
160
+ return tableData.value;
161
+ });
150
162
  const tableLoading = vue.ref(false);
151
163
  const loadData = async () => {
152
164
  if (props.request) {
@@ -211,7 +223,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
211
223
  }, vue.createSlots({
212
224
  body: vue.withCtx(({ height: bodyHeight }) => [
213
225
  vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(index.FcTable), vue.mergeProps(_ctx.$attrs, {
214
- data: tableData.value,
226
+ data: displayData.value,
215
227
  border: "",
216
228
  "max-height": bodyHeight,
217
229
  onSelectionChange: handleSelectionChange
@@ -292,7 +304,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
292
304
  ]),
293
305
  key: "0"
294
306
  } : void 0,
295
- __props.isPagination ? {
307
+ showPagination.value ? {
296
308
  name: "footer",
297
309
  fn: vue.withCtx(() => [
298
310
  vue.createVNode(vue.unref(index$2.FcPagination), {
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const version = "1.1.33";
5
+ const version = "1.1.34";
6
6
 
7
7
  exports.version = version;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, resolveComponent, resolveDirective, createBlock, openBlock, normalizeClass, unref, createSlots, withCtx, withDirectives, mergeProps, createCommentVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createVNode, renderSlot, h } from 'vue';
1
+ import { defineComponent, computed, ref, onMounted, resolveComponent, resolveDirective, createBlock, openBlock, normalizeClass, unref, createSlots, withCtx, withDirectives, mergeProps, createCommentVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createVNode, renderSlot, h } from 'vue';
2
2
  import { useNamespace } from '../../hooks/use-namespace.mjs';
3
3
  import { FcDangerButton, FcLinkButton } from '../../components/Button/index.mjs';
4
4
  import '../../components/Dialog/index.mjs';
@@ -94,6 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
94
94
  columns: { default: () => [] },
95
95
  isPagination: { type: Boolean, default: true },
96
96
  fields: { default: () => [] },
97
+ data: { default: void 0 },
97
98
  request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
98
99
  actions: { default: () => [] },
99
100
  actionsWidth: { default: 0 },
@@ -102,6 +103,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
102
103
  setup(__props, { expose: __expose }) {
103
104
  const ns = useNamespace("data-table");
104
105
  const props = __props;
106
+ const showPagination = computed(() => {
107
+ if (!props.isPagination) return false;
108
+ if (props.data !== void 0) return false;
109
+ return true;
110
+ });
105
111
  const renderActions = (actions, row, index) => {
106
112
  return h(
107
113
  "div",
@@ -143,6 +149,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
143
149
  return (pagination.value.currentPage - 1) * pagination.value.pageSize + i + 1;
144
150
  };
145
151
  const tableData = ref([]);
152
+ const displayData = computed(() => {
153
+ if (props.data !== void 0) {
154
+ return props.data || [];
155
+ }
156
+ return tableData.value;
157
+ });
146
158
  const tableLoading = ref(false);
147
159
  const loadData = async () => {
148
160
  if (props.request) {
@@ -207,7 +219,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
207
219
  }, createSlots({
208
220
  body: withCtx(({ height: bodyHeight }) => [
209
221
  withDirectives((openBlock(), createBlock(unref(FcTable), mergeProps(_ctx.$attrs, {
210
- data: tableData.value,
222
+ data: displayData.value,
211
223
  border: "",
212
224
  "max-height": bodyHeight,
213
225
  onSelectionChange: handleSelectionChange
@@ -288,7 +300,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
288
300
  ]),
289
301
  key: "0"
290
302
  } : void 0,
291
- __props.isPagination ? {
303
+ showPagination.value ? {
292
304
  name: "footer",
293
305
  fn: withCtx(() => [
294
306
  createVNode(unref(FcPagination), {
@@ -1,3 +1,3 @@
1
- const version = "1.1.33";
1
+ const version = "1.1.34";
2
2
 
3
3
  export { version };
@@ -32,6 +32,7 @@ export type TFcProDataTableProps = {
32
32
  }>;
33
33
  isPagination?: boolean;
34
34
  fields?: Array<TProFormField>;
35
+ data?: any[] | undefined;
35
36
  request?: (params: any) => Promise<RequestResult<any>>;
36
37
  actions?: Array<ButtonProps>;
37
38
  actionsWidth?: number;
@@ -1476,6 +1476,7 @@ declare const __VLS_component: import('vue').DefineComponent<TFcProDataTableProp
1476
1476
  resetSearch: () => void;
1477
1477
  selectedRows: import('vue').Ref<any[], any[]>;
1478
1478
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TFcProDataTableProps> & Readonly<{}>, {
1479
+ data: any[];
1479
1480
  height: number;
1480
1481
  fields: Array<import('..').TProFormField>;
1481
1482
  tools: Array<ButtonProps>;
@@ -6,6 +6,7 @@ export declare const FcProDataTable: {
6
6
  resetSearch: () => void;
7
7
  selectedRows: import('vue').Ref<any[], any[]>;
8
8
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
9
+ data: any[];
9
10
  height: number;
10
11
  fields: Array<import('..').TProFormField>;
11
12
  tools: Array<import('./DataTable.types').ButtonProps>;
@@ -1496,6 +1497,7 @@ export declare const FcProDataTable: {
1496
1497
  resetSearch: () => void;
1497
1498
  selectedRows: import('vue').Ref<any[], any[]>;
1498
1499
  }, {}, {}, {}, {
1500
+ data: any[];
1499
1501
  height: number;
1500
1502
  fields: Array<import('..').TProFormField>;
1501
1503
  tools: Array<import('./DataTable.types').ButtonProps>;
@@ -1522,6 +1524,7 @@ export declare const FcProDataTable: {
1522
1524
  resetSearch: () => void;
1523
1525
  selectedRows: import('vue').Ref<any[], any[]>;
1524
1526
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
1527
+ data: any[];
1525
1528
  height: number;
1526
1529
  fields: Array<import('..').TProFormField>;
1527
1530
  tools: Array<import('./DataTable.types').ButtonProps>;
@@ -52,6 +52,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
52
52
  }> | undefined;
53
53
  readonly isPagination?: boolean | undefined;
54
54
  readonly fields?: Array<import('..').TProFormField> | undefined;
55
+ readonly data?: any[] | undefined | undefined;
55
56
  readonly request?: ((params: any) => Promise<import('..').RequestResult<any>>) | undefined;
56
57
  readonly actions?: Array<import('..').ButtonProps> | undefined;
57
58
  readonly actionsWidth?: number | undefined;
@@ -1539,6 +1540,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
1539
1540
  resetSearch: () => void;
1540
1541
  selectedRows: import('vue').Ref<any[], any[]>;
1541
1542
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
1543
+ data: any[];
1542
1544
  height: number;
1543
1545
  fields: Array<import('..').TProFormField>;
1544
1546
  tools: Array<import('..').ButtonProps>;
@@ -1575,6 +1577,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
1575
1577
  $nextTick: typeof import('vue').nextTick;
1576
1578
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1577
1579
  } & Readonly<{
1580
+ data: any[];
1578
1581
  height: number;
1579
1582
  fields: Array<import('..').TProFormField>;
1580
1583
  tools: Array<import('..').ButtonProps>;
@@ -1590,7 +1593,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
1590
1593
  request: (params: any) => Promise<import('..').RequestResult<any>>;
1591
1594
  actions: Array<import('..').ButtonProps>;
1592
1595
  actionsWidth: number;
1593
- }> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
1596
+ }> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("data" | "height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
1594
1597
  loadData: () => Promise<void>;
1595
1598
  tableData: import('vue').Ref<any[], any[]>;
1596
1599
  reload: () => void;
@@ -52,6 +52,7 @@ export declare const FcProDataTableDialog: {
52
52
  }> | undefined;
53
53
  readonly isPagination?: boolean | undefined;
54
54
  readonly fields?: Array<import('..').TProFormField> | undefined;
55
+ readonly data?: any[] | undefined | undefined;
55
56
  readonly request?: ((params: any) => Promise<import('..').RequestResult<any>>) | undefined;
56
57
  readonly actions?: Array<import('..').ButtonProps> | undefined;
57
58
  readonly actionsWidth?: number | undefined;
@@ -1539,6 +1540,7 @@ export declare const FcProDataTableDialog: {
1539
1540
  resetSearch: () => void;
1540
1541
  selectedRows: import('vue').Ref<any[], any[]>;
1541
1542
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
1543
+ data: any[];
1542
1544
  height: number;
1543
1545
  fields: Array<import('..').TProFormField>;
1544
1546
  tools: Array<import('..').ButtonProps>;
@@ -1575,6 +1577,7 @@ export declare const FcProDataTableDialog: {
1575
1577
  $nextTick: typeof import('vue').nextTick;
1576
1578
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1577
1579
  } & Readonly<{
1580
+ data: any[];
1578
1581
  height: number;
1579
1582
  fields: Array<import('..').TProFormField>;
1580
1583
  tools: Array<import('..').ButtonProps>;
@@ -1590,7 +1593,7 @@ export declare const FcProDataTableDialog: {
1590
1593
  request: (params: any) => Promise<import('..').RequestResult<any>>;
1591
1594
  actions: Array<import('..').ButtonProps>;
1592
1595
  actionsWidth: number;
1593
- }> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
1596
+ }> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("data" | "height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
1594
1597
  loadData: () => Promise<void>;
1595
1598
  tableData: import('vue').Ref<any[], any[]>;
1596
1599
  reload: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funcho/ui",
3
3
  "description": "@funcho ui library",
4
- "version": "1.1.33",
4
+ "version": "1.1.34",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.mjs",