cosey 0.11.5 → 0.11.7

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.
@@ -5,7 +5,7 @@ export * from './useTable';
5
5
  declare const _Table: {
6
6
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
7
7
  api: {
8
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
8
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
9
9
  };
10
10
  immediate: {
11
11
  type: BooleanConstructor;
@@ -131,7 +131,7 @@ declare const _Table: {
131
131
  type: import("vue").PropType<(res: any) => any>;
132
132
  };
133
133
  parallelFetch: {
134
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
134
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
135
135
  };
136
136
  toolbarConfig: {
137
137
  type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
@@ -141,7 +141,7 @@ declare const _Table: {
141
141
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
142
142
  };
143
143
  statsColumns: {
144
- type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[]>>;
144
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[] | null | undefined | boolean>>;
145
145
  };
146
146
  statsData: {
147
147
  type: import("vue").MaybeRef<any>;
@@ -316,7 +316,7 @@ declare const _Table: {
316
316
  Defaults: {};
317
317
  }, Readonly<import("vue").ExtractPropTypes<{
318
318
  api: {
319
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
319
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
320
320
  };
321
321
  immediate: {
322
322
  type: BooleanConstructor;
@@ -442,7 +442,7 @@ declare const _Table: {
442
442
  type: import("vue").PropType<(res: any) => any>;
443
443
  };
444
444
  parallelFetch: {
445
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
445
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
446
446
  };
447
447
  toolbarConfig: {
448
448
  type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
@@ -452,7 +452,7 @@ declare const _Table: {
452
452
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
453
453
  };
454
454
  statsColumns: {
455
- type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[]>>;
455
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[] | null | undefined | boolean>>;
456
456
  };
457
457
  statsData: {
458
458
  type: import("vue").MaybeRef<any>;
@@ -624,7 +624,7 @@ declare const _Table: {
624
624
  __isSuspense?: never;
625
625
  } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
626
626
  api: {
627
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
627
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
628
628
  };
629
629
  immediate: {
630
630
  type: BooleanConstructor;
@@ -654,7 +654,7 @@ declare const _Table: {
654
654
  type: import("vue").PropType<(res: any) => any>;
655
655
  };
656
656
  parallelFetch: {
657
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
657
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
658
658
  };
659
659
  toolbarConfig: {
660
660
  type: import("vue").PropType<import("./table").ToolbarConfig | boolean>;
@@ -664,7 +664,7 @@ declare const _Table: {
664
664
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
665
665
  };
666
666
  statsColumns: {
667
- type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[]>>;
667
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[] | null | undefined | boolean>>;
668
668
  };
669
669
  statsData: {
670
670
  type: import("vue").MaybeRef<any>;
@@ -18,7 +18,7 @@ export declare const tableEmitOnProps: Record<string, {
18
18
  }>;
19
19
  export declare const tableProps: {
20
20
  api: {
21
- type: PropType<(...args: any[]) => Promise<any> | any>;
21
+ type: PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
22
22
  };
23
23
  immediate: {
24
24
  type: BooleanConstructor;
@@ -48,7 +48,7 @@ export declare const tableProps: {
48
48
  type: PropType<(res: any) => any>;
49
49
  };
50
50
  parallelFetch: {
51
- type: PropType<(...args: any[]) => Promise<any> | any>;
51
+ type: PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
52
52
  };
53
53
  toolbarConfig: {
54
54
  type: PropType<ToolbarConfig | boolean>;
@@ -58,7 +58,7 @@ export declare const tableProps: {
58
58
  type: PropType<TableConfig["keys"]>;
59
59
  };
60
60
  statsColumns: {
61
- type: PropType<MaybeRef<TableStatisticsColumn[]>>;
61
+ type: PropType<MaybeRef<TableStatisticsColumn[] | null | undefined | boolean>>;
62
62
  };
63
63
  statsData: {
64
64
  type: MaybeRef<any>;
@@ -37,7 +37,7 @@ const tableEmitOnProps = tableEmitOnEvents.reduce(
37
37
  );
38
38
  const tableExtraProps = {
39
39
  api: {
40
- type: Function
40
+ type: null
41
41
  },
42
42
  immediate: {
43
43
  type: Boolean,
@@ -67,7 +67,7 @@ const tableExtraProps = {
67
67
  type: Function
68
68
  },
69
69
  parallelFetch: {
70
- type: Function
70
+ type: null
71
71
  },
72
72
  toolbarConfig: {
73
73
  type: [Object, Boolean],
@@ -77,7 +77,7 @@ const tableExtraProps = {
77
77
  type: Object
78
78
  },
79
79
  statsColumns: {
80
- type: Object
80
+ type: null
81
81
  },
82
82
  statsData: {
83
83
  type: Object
@@ -3,7 +3,7 @@ import { type TableSlots, type TableExpose, type ToolbarConfig } from './table';
3
3
  type __VLS_Slots = TableSlots;
4
4
  declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
5
  api: {
6
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
6
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
7
7
  };
8
8
  immediate: {
9
9
  type: BooleanConstructor;
@@ -33,7 +33,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
33
33
  type: import("vue").PropType<(res: any) => any>;
34
34
  };
35
35
  parallelFetch: {
36
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
36
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
37
37
  };
38
38
  toolbarConfig: {
39
39
  type: import("vue").PropType<ToolbarConfig | boolean>;
@@ -43,7 +43,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
43
43
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
44
44
  };
45
45
  statsColumns: {
46
- type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[]>>;
46
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[] | null | undefined | boolean>>;
47
47
  };
48
48
  statsData: {
49
49
  type: import("vue").MaybeRef<any>;
@@ -184,7 +184,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
184
184
  updateKeyChildren: (key: string, data: any[]) => void;
185
185
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
186
186
  api: {
187
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
187
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
188
188
  };
189
189
  immediate: {
190
190
  type: BooleanConstructor;
@@ -214,7 +214,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
214
214
  type: import("vue").PropType<(res: any) => any>;
215
215
  };
216
216
  parallelFetch: {
217
- type: import("vue").PropType<(...args: any[]) => Promise<any> | any>;
217
+ type: import("vue").PropType<((...args: any[]) => Promise<any> | any) | boolean | null | undefined>;
218
218
  };
219
219
  toolbarConfig: {
220
220
  type: import("vue").PropType<ToolbarConfig | boolean>;
@@ -224,7 +224,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
224
224
  type: import("vue").PropType<import("./table").TableConfig["keys"]>;
225
225
  };
226
226
  statsColumns: {
227
- type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[]>>;
227
+ type: import("vue").PropType<import("vue").MaybeRef<import("./table-stats/table-stats.api").TableStatisticsColumn[] | null | undefined | boolean>>;
228
228
  };
229
229
  statsData: {
230
230
  type: import("vue").MaybeRef<any>;
@@ -19,7 +19,7 @@ import { useLocale } from '../../hooks/useLocale.js';
19
19
  import { auid } from '../../utils/string.js';
20
20
  import { useComponentConfig, useConfig } from '../config-provider/config-provider.api.js';
21
21
  import { addPxUnit } from '../../utils/css.js';
22
- import { isNullish, isObject, isFunction } from '../../utils/is.js';
22
+ import { isNullish, isFunction, isObject } from '../../utils/is.js';
23
23
  import { getVNodeText, createMergedExpose } from '../../utils/vue.js';
24
24
  import { useFetch } from '../../hooks/useFetch.js';
25
25
  import { useResizeObserver } from '../../hooks/useResizeObserver.js';
@@ -179,11 +179,11 @@ var stdin_default = /* @__PURE__ */defineComponent({
179
179
  execute
180
180
  } = useFetch(() => {
181
181
  const params = getFullFetchParams();
182
- return Promise.all([props.api?.({
182
+ return Promise.all([isFunction(props.api) ? props.api({
183
183
  ...params
184
- }), props.parallelFetch?.({
184
+ }) : null, isFunction(props.parallelFetch) ? props.parallelFetch({
185
185
  ...params
186
- })]);
186
+ }) : null]);
187
187
  }, {
188
188
  immediate: false,
189
189
  onSuccess([res]) {
@@ -207,7 +207,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
207
207
  }
208
208
  };
209
209
  onMounted(() => {
210
- if (props.immediate && props.api) {
210
+ if (props.immediate && isFunction(props.api)) {
211
211
  validateExecute();
212
212
  }
213
213
  });
@@ -365,7 +365,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
365
365
  };
366
366
  const statsColumns = computed(() => unref(props.statsColumns));
367
367
  const statsData = computed(() => unref(props.statsData));
368
- const isStatsVisible = computed(() => statsColumns.value && statsColumns.value.length > 0);
368
+ const isStatsVisible = computed(() => Array.isArray(statsColumns.value) && statsColumns.value.length > 0);
369
+ const finalStatsColumns = computed(() => {
370
+ return Array.isArray(statsColumns.value) ? statsColumns.value : [];
371
+ });
369
372
  const rootRef = ref(null);
370
373
  const getRootEl = () => rootRef.value;
371
374
  const expose = createMergedExpose(tableExposeKeys, () => elTableRef.value, {
@@ -435,7 +438,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
435
438
  key: 0,
436
439
  class: normalizeClass(`${unref(prefixCls)}-stats-wrapper`)
437
440
  }, [createVNode(unref(stdin_default$3), {
438
- columns: statsColumns.value,
441
+ columns: finalStatsColumns.value,
439
442
  data: statsData.value
440
443
  }, null, 8, ["columns", "data"])], 2
441
444
  /* CLASS */)) : createCommentVNode("v-if", true)], 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.11.5",
3
+ "version": "0.11.7",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/utils/tree.js CHANGED
@@ -109,8 +109,11 @@ function mapTreeExtra(tree, callback, options, _internalLevel = 1) {
109
109
  }
110
110
  function getNextSibling(node, mergeLast) {
111
111
  if (node) {
112
- const nextSibling = node.nextSibling;
113
- if (nextSibling && (!mergeLast || nextSibling.reverseLevel > 1 || nextSibling.prevSibling?.reverseLevel !== 1)) {
112
+ let nextSibling = node.nextSibling;
113
+ while (mergeLast && nextSibling && nextSibling.reverseLevel === 1 && nextSibling.prevSibling?.reverseLevel === 1) {
114
+ nextSibling = nextSibling.nextSibling;
115
+ }
116
+ if (nextSibling) {
114
117
  return nextSibling;
115
118
  } else {
116
119
  return getNextSibling(node.parent, mergeLast);