lkt-table 2.0.0 → 2.0.3

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,11 +1,7 @@
1
- import { LktObject } from "lkt-vue-kernel";
1
+ import { ButtonConfig } from "lkt-vue-kernel";
2
2
  type __VLS_Props = {
3
+ config?: ButtonConfig;
3
4
  disabled?: boolean;
4
- text: string;
5
- icon: string;
6
- confirm: string;
7
- resource: string;
8
- resourceData: LktObject;
9
5
  };
10
6
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
7
  click: (...args: any[]) => void;
@@ -13,10 +9,5 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
13
9
  onClick?: ((...args: any[]) => any) | undefined;
14
10
  }>, {
15
11
  disabled: boolean;
16
- resource: string;
17
- resourceData: LktObject;
18
- text: string;
19
- icon: string;
20
- confirm: string;
21
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
13
  export default _default;
@@ -1,3 +1,5 @@
1
+ import { getColumnDisplayContent } from "../functions/table-functions";
2
+ import LktTableCell from "./LktTableCell.vue";
1
3
  import { LktObject, Column } from "lkt-vue-kernel";
2
4
  type __VLS_Props = {
3
5
  modelValue: LktObject;
@@ -12,40 +14,64 @@ type __VLS_Props = {
12
14
  editModeEnabled: boolean;
13
15
  hasInlineEditPerm: boolean;
14
16
  };
15
- declare function __VLS_template(): {
16
- attrs: Partial<{}>;
17
- slots: Partial<Record<string, (_: {
18
- value: any;
19
- item: LktObject;
20
- column: Column;
21
- i: number;
22
- }) => any>>;
23
- refs: {};
24
- rootEl: HTMLTableRowElement;
17
+ declare const item: import("vue").Ref<LktObject, LktObject>;
18
+ declare const onClick: ($event: any) => void;
19
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
20
+ declare var __VLS_2: string, __VLS_3: {
21
+ value: any;
22
+ item: LktObject;
23
+ column: Column;
24
+ i: number;
25
25
  };
26
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
27
+ [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
28
+ }>;
29
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
30
+ getColumnDisplayContent: typeof getColumnDisplayContent;
31
+ LktTableCell: typeof LktTableCell;
32
+ item: typeof item;
33
+ onClick: typeof onClick;
34
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
35
  "update:modelValue": (...args: any[]) => void;
29
36
  click: (...args: any[]) => void;
30
37
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
31
38
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
32
39
  onClick?: ((...args: any[]) => any) | undefined;
33
40
  }>, {
41
+ modelValue: LktObject;
42
+ i: number;
43
+ editModeEnabled: boolean;
44
+ hasInlineEditPerm: boolean;
45
+ isDraggable: boolean;
34
46
  sortable: boolean;
47
+ hiddenIsVisible: boolean;
48
+ visibleColumns: Column[];
49
+ emptyColumns: string[];
50
+ hiddenColumnsColSpan: number;
51
+ hiddenColumns: Column[];
52
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
53
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
54
+ "update:modelValue": (...args: any[]) => void;
55
+ click: (...args: any[]) => void;
56
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
57
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
58
+ onClick?: ((...args: any[]) => any) | undefined;
59
+ }>, {
35
60
  modelValue: LktObject;
36
61
  i: number;
37
62
  editModeEnabled: boolean;
38
63
  hasInlineEditPerm: boolean;
39
64
  isDraggable: boolean;
65
+ sortable: boolean;
40
66
  hiddenIsVisible: boolean;
41
67
  visibleColumns: Column[];
42
68
  emptyColumns: string[];
43
69
  hiddenColumnsColSpan: number;
44
70
  hiddenColumns: Column[];
45
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLTableRowElement>;
46
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
71
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
72
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
47
73
  export default _default;
48
- type __VLS_WithTemplateSlots<T, S> = T & {
74
+ type __VLS_WithSlots<T, S> = T & {
49
75
  new (): {
50
76
  $slots: S;
51
77
  };
@@ -1,6 +1,14 @@
1
- import { Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
1
+ import { canRenderColumn, colPreferSlot, getColumnClasses, getColumnDisplayContent, getHorizontalColSpan } from "../functions/table-functions";
2
+ import LktTableCell from "./LktTableCell.vue";
3
+ import DropButton from "./DropButton.vue";
4
+ import EditButton from "./EditButton.vue";
5
+ import { ButtonConfig, Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
6
+ declare const slots: Readonly<{
7
+ [name: string]: import("vue").Slot<any> | undefined;
8
+ }>;
2
9
  type __VLS_Props = {
3
10
  modelValue: LktObject;
11
+ dropButton: ButtonConfig;
4
12
  isDraggable: boolean;
5
13
  sortable: boolean;
6
14
  displayHiddenColumnsIndicator: boolean;
@@ -14,10 +22,6 @@ type __VLS_Props = {
14
22
  i: number;
15
23
  visibleColumns: Column[];
16
24
  emptyColumns: string[];
17
- dropConfirm: string;
18
- dropText: string;
19
- dropIcon: string;
20
- dropResource: string;
21
25
  editText: string;
22
26
  editIcon: string;
23
27
  editLink: string;
@@ -25,9 +29,57 @@ type __VLS_Props = {
25
29
  renderDrag?: boolean | Function;
26
30
  disabledDrag?: boolean | Function;
27
31
  };
28
- declare function __VLS_template(): any;
29
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
30
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ declare const Item: import("vue").Ref<LktObject, LktObject>;
33
+ declare const canCustomItem: boolean;
34
+ declare const canItem: boolean;
35
+ declare const parsedEditLink: import("vue").Ref<string, string>;
36
+ declare const onClick: ($event: any) => void, onShow: ($event: any, i: any) => void, classes: import("vue").ComputedRef<string>, hasNavButtonSlot: import("vue").ComputedRef<boolean>, navButtonSlot: import("vue").ComputedRef<string | import("vue").Component>, onClickUp: () => void, onClickDown: () => void, onClickDrop: () => void, onClickEdit: () => void;
37
+ declare const canRenderDragIndicator: import("vue").ComputedRef<any>;
38
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
39
+ declare var __VLS_26: `item-${number}`, __VLS_27: {
40
+ item: LktObject;
41
+ index: number;
42
+ }, __VLS_29: {
43
+ item: LktObject;
44
+ index: number;
45
+ }, __VLS_32: string, __VLS_33: {
46
+ value: any;
47
+ item: LktObject;
48
+ column: Column;
49
+ i: number;
50
+ };
51
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
52
+ [K in NonNullable<typeof __VLS_26>]?: (props: typeof __VLS_27) => any;
53
+ } & {
54
+ [K in NonNullable<typeof __VLS_32>]?: (props: typeof __VLS_33) => any;
55
+ } & {
56
+ item?: (props: typeof __VLS_29) => any;
57
+ }>;
58
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
59
+ canRenderColumn: typeof canRenderColumn;
60
+ colPreferSlot: typeof colPreferSlot;
61
+ getColumnClasses: typeof getColumnClasses;
62
+ getColumnDisplayContent: typeof getColumnDisplayContent;
63
+ getHorizontalColSpan: typeof getHorizontalColSpan;
64
+ LktTableCell: typeof LktTableCell;
65
+ DropButton: typeof DropButton;
66
+ EditButton: typeof EditButton;
67
+ slots: typeof slots;
68
+ Item: typeof Item;
69
+ canCustomItem: typeof canCustomItem;
70
+ canItem: typeof canItem;
71
+ parsedEditLink: typeof parsedEditLink;
72
+ onClick: typeof onClick;
73
+ onShow: typeof onShow;
74
+ classes: typeof classes;
75
+ hasNavButtonSlot: typeof hasNavButtonSlot;
76
+ navButtonSlot: typeof navButtonSlot;
77
+ onClickUp: typeof onClickUp;
78
+ onClickDown: typeof onClickDown;
79
+ onClickDrop: typeof onClickDrop;
80
+ onClickEdit: typeof onClickEdit;
81
+ canRenderDragIndicator: typeof canRenderDragIndicator;
82
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
83
  "update:modelValue": (...args: any[]) => void;
32
84
  click: (...args: any[]) => void;
33
85
  show: (...args: any[]) => void;
@@ -42,11 +94,46 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
42
94
  "onItem-down"?: ((...args: any[]) => any) | undefined;
43
95
  "onItem-drop"?: ((...args: any[]) => any) | undefined;
44
96
  }>, {
97
+ modelValue: LktObject;
98
+ i: number;
99
+ editModeEnabled: boolean;
100
+ isDraggable: boolean;
45
101
  sortable: boolean;
102
+ displayHiddenColumnsIndicator: boolean;
103
+ hiddenIsVisible: boolean;
104
+ addNavigation: boolean;
105
+ latestRow: boolean;
106
+ canDrop: boolean;
107
+ canEdit: boolean;
108
+ visibleColumns: Column[];
109
+ emptyColumns: string[];
110
+ editText: string;
111
+ editIcon: string;
112
+ editLink: string;
113
+ rowDisplayType: ValidTableRowTypeValue;
114
+ renderDrag: boolean | Function;
115
+ disabledDrag: boolean | Function;
116
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
117
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
118
+ "update:modelValue": (...args: any[]) => void;
119
+ click: (...args: any[]) => void;
120
+ show: (...args: any[]) => void;
121
+ "item-up": (...args: any[]) => void;
122
+ "item-down": (...args: any[]) => void;
123
+ "item-drop": (...args: any[]) => void;
124
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
125
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
126
+ onClick?: ((...args: any[]) => any) | undefined;
127
+ onShow?: ((...args: any[]) => any) | undefined;
128
+ "onItem-up"?: ((...args: any[]) => any) | undefined;
129
+ "onItem-down"?: ((...args: any[]) => any) | undefined;
130
+ "onItem-drop"?: ((...args: any[]) => any) | undefined;
131
+ }>, {
46
132
  modelValue: LktObject;
47
133
  i: number;
48
134
  editModeEnabled: boolean;
49
135
  isDraggable: boolean;
136
+ sortable: boolean;
50
137
  displayHiddenColumnsIndicator: boolean;
51
138
  hiddenIsVisible: boolean;
52
139
  addNavigation: boolean;
@@ -55,10 +142,6 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
55
142
  canEdit: boolean;
56
143
  visibleColumns: Column[];
57
144
  emptyColumns: string[];
58
- dropConfirm: string;
59
- dropText: string;
60
- dropIcon: string;
61
- dropResource: string;
62
145
  editText: string;
63
146
  editIcon: string;
64
147
  editLink: string;
@@ -66,9 +149,9 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
66
149
  renderDrag: boolean | Function;
67
150
  disabledDrag: boolean | Function;
68
151
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
152
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
70
153
  export default _default;
71
- type __VLS_WithTemplateSlots<T, S> = T & {
154
+ type __VLS_WithSlots<T, S> = T & {
72
155
  new (): {
73
156
  $slots: S;
74
157
  };
@@ -16,5 +16,5 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
16
16
  sortDirection: string;
17
17
  amountOfColumns: number;
18
18
  items: LktObject[];
19
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLTableCellElement>;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
20
  export default _default;
@@ -1,9 +1,4 @@
1
- import { Column, ColumnConfig, LktObject, SortDirection } from "lkt-vue-kernel";
2
- /**
3
- *
4
- * @param data
5
- */
6
- export declare const createColumn: (data: ColumnConfig) => Column;
1
+ import { Column, LktObject, SortDirection } from "lkt-vue-kernel";
7
2
  /**
8
3
  *
9
4
  * @param a
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Component, Plugin } from "vue";
2
- export { createColumn } from "./functions/table-functions";
3
- export { Column } from "lkt-vue-kernel";
2
+ export { createColumn, Column } from "lkt-vue-kernel";
4
3
  import "./../lkt-table.css";
5
4
  declare const LktTable: Plugin;
6
5
  export default LktTable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -16,7 +16,7 @@
16
16
  ".": {
17
17
  "import": "./dist/build.js"
18
18
  },
19
- "./styles": "./dist/style.css",
19
+ "./styles": "./dist/build.css",
20
20
  "./theme": "./theme/default.css",
21
21
  "./theme/default": "./theme/default.css"
22
22
  },
@@ -33,32 +33,33 @@
33
33
  "rebuild": "rm -rf dist/*; vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/"
34
34
  },
35
35
  "author": "Antonio Ibáñez",
36
+ "engines": {
37
+ "node": ">=18"
38
+ },
36
39
  "devDependencies": {
37
40
  "@babel/types": "^7.23.6",
38
41
  "@types/node": "^20.11.19",
39
42
  "@types/rollup": "^0.54.0",
40
43
  "@vitejs/plugin-vue": "^5.2.1",
41
- "rollup": "^4.9.6",
42
- "typescript": "^5.7",
43
- "vite": "^5.4.14",
44
- "vue-tsc": "^2.2"
45
- },
46
- "engines": {
47
- "node": ">=18"
44
+ "rollup": "^4.34.8",
45
+ "typescript": "^5.7.3",
46
+ "vite": "^6.1.1",
47
+ "vue-tsc": "^2.2.0"
48
48
  },
49
49
  "dependencies": {
50
- "lkt-button": "^1.1.16",
50
+ "sortablejs": "^1.15.6"
51
+ },
52
+ "peerDependencies": {
53
+ "lkt-button": "^2.0",
51
54
  "lkt-data-state": "^1.0.10",
52
55
  "lkt-date-tools": "^1.0.4",
53
- "lkt-field": "^0.0.14",
56
+ "lkt-field": "^0.0.34",
54
57
  "lkt-http-client": "^1.0.19",
55
58
  "lkt-i18n": "^1.0.4",
56
59
  "lkt-loader": "^1.0.2",
57
- "lkt-paginator": "^1.1.4",
60
+ "lkt-paginator": "^1.3.0",
58
61
  "lkt-string-tools": "^1.0.3",
59
- "lkt-ts-interfaces": "^1.0.2",
60
62
  "lkt-vue-kernel": "^1.0.4",
61
- "sortablejs": "^1.15.2",
62
63
  "vue": "^3.3",
63
64
  "vue-router": "^4.2.5"
64
65
  }
@@ -1,24 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
- import {LktObject} from "lkt-vue-kernel";
4
+ import {ButtonConfig} from "lkt-vue-kernel";
5
5
 
6
6
  const emit = defineEmits(['click']);
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
+ config?: ButtonConfig
9
10
  disabled?: boolean
10
- text: string
11
- icon: string
12
- confirm: string
13
- resource: string
14
- resourceData: LktObject
15
11
  }>(), {
16
12
  disabled: false,
17
- text: '',
18
- icon: '',
19
- confirm: '',
20
- resource: '',
21
- resourceData: () => ({}),
22
13
  });
23
14
 
24
15
  const hasButtonSlot = computed(() => Settings.dropButtonSlot !== ''),
@@ -28,11 +19,9 @@ const hasButtonSlot = computed(() => Settings.dropButtonSlot !== ''),
28
19
  <template>
29
20
  <lkt-button
30
21
  palette="table-delete"
31
- :icon="hasButtonSlot ? '' : icon"
32
- :text="hasButtonSlot ? '' : text"
33
- :resource="resource"
34
- :resource-data="resourceData"
35
- :confirm-modal="confirm"
22
+ v-bind="props.config"
23
+ :icon="hasButtonSlot ? '' : config?.icon"
24
+ :text="hasButtonSlot ? '' : config?.text"
36
25
  :disabled="disabled"
37
26
  @click.prevent.stop="emit('click')">
38
27
  <template v-if="hasButtonSlot">
@@ -12,13 +12,14 @@ import {Settings} from "../settings/Settings";
12
12
  import DropButton from "./DropButton.vue";
13
13
  import EditButton from "./EditButton.vue";
14
14
  import {replaceAll} from "lkt-string-tools";
15
- import {Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
15
+ import {ButtonConfig, Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
16
16
 
17
17
  const slots = useSlots();
18
18
  const emit = defineEmits(['update:modelValue', 'click', 'show', 'item-up', 'item-down', 'item-drop']);
19
19
 
20
20
  const props = withDefaults(defineProps<{
21
21
  modelValue: LktObject
22
+ dropButton: ButtonConfig
22
23
  isDraggable: boolean
23
24
  sortable: boolean
24
25
  displayHiddenColumnsIndicator: boolean
@@ -32,10 +33,6 @@ const props = withDefaults(defineProps<{
32
33
  i: number
33
34
  visibleColumns: Column[]
34
35
  emptyColumns: string[]
35
- dropConfirm: string
36
- dropText: string
37
- dropIcon: string
38
- dropResource: string
39
36
  editText: string
40
37
  editIcon: string
41
38
  editLink: string
@@ -56,10 +53,6 @@ const props = withDefaults(defineProps<{
56
53
  i: 0,
57
54
  visibleColumns: () => [],
58
55
  emptyColumns: () => [],
59
- dropConfirm: '',
60
- dropText: '',
61
- dropIcon: '',
62
- dropResource: '',
63
56
  editText: '',
64
57
  editIcon: '',
65
58
  editLink: '',
@@ -88,9 +81,11 @@ const onClick = ($event: any) => emit('click', $event),
88
81
 
89
82
  let disabledDrag = false;
90
83
  if (typeof props.disabledDrag === 'function') disabledDrag = props.disabledDrag(Item.value);
91
- else disabledDrag = props.disabledDrag === true;
84
+ else disabledDrag = computedDisabledDrag.value === true;
85
+
92
86
  if (!disabledDrag && props.sortable && props.isDraggable) r.push('handle');
93
87
  else if (disabledDrag) r.push('disabled');
88
+
94
89
  return r.join(' ');
95
90
  }),
96
91
  hasNavButtonSlot = computed(() => {
@@ -205,11 +200,7 @@ const canRenderDragIndicator = computed(() => {
205
200
  </template>
206
201
  <td v-if="canDrop && editModeEnabled" class="lkt-table-col-drop">
207
202
  <drop-button
208
- :resource="dropResource"
209
- :resource-data="Item"
210
- :confirm="dropConfirm"
211
- :text="dropText"
212
- :icon="dropIcon"
203
+ :config="dropButton"
213
204
  @click="onClickDrop"/>
214
205
  </td>
215
206
  <td v-if="canEdit && editModeEnabled" class="lkt-table-col-edit">