lkt-table 1.4.2 → 2.0.0

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 { ModalConfig } 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
- to?: string;
7
- modal?: string;
8
- modalData?: Partial<ModalConfig>;
9
5
  };
10
6
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
7
  click: (...args: any[]) => void;
@@ -14,10 +10,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
14
10
  onClick?: ((...args: any[]) => any) | undefined;
15
11
  onAppend?: ((...args: any[]) => any) | undefined;
16
12
  }>, {
17
- text: string;
18
13
  disabled: boolean;
19
- to: string;
20
- icon: string;
21
- modal: string;
14
+ config: ButtonConfig;
22
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
16
  export default _default;
@@ -12,11 +12,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
12
12
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
13
  onClick?: ((...args: any[]) => any) | undefined;
14
14
  }>, {
15
- text: string;
16
15
  disabled: boolean;
17
- confirm: string;
18
- icon: string;
19
16
  resource: string;
20
17
  resourceData: LktObject;
18
+ text: string;
19
+ icon: string;
20
+ confirm: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  export default _default;
@@ -14,11 +14,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
14
14
  onClick?: ((...args: any[]) => any) | undefined;
15
15
  }>, {
16
16
  link: string;
17
- text: string;
18
17
  disabled: boolean;
19
- confirm: string;
20
- icon: string;
21
18
  resource: string;
22
19
  resourceData: LktObject;
20
+ text: string;
21
+ icon: string;
22
+ confirm: string;
23
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
24
  export default _default;
@@ -25,15 +25,15 @@ declare function __VLS_template(): {
25
25
  };
26
26
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
27
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
- click: (...args: any[]) => void;
29
28
  "update:modelValue": (...args: any[]) => void;
29
+ click: (...args: any[]) => void;
30
30
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
31
- onClick?: ((...args: any[]) => any) | undefined;
32
31
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
32
+ onClick?: ((...args: any[]) => any) | undefined;
33
33
  }>, {
34
- i: number;
35
34
  sortable: boolean;
36
35
  modelValue: LktObject;
36
+ i: number;
37
37
  editModeEnabled: boolean;
38
38
  hasInlineEditPerm: boolean;
39
39
  isDraggable: boolean;
@@ -12,10 +12,10 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
12
12
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
13
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
14
14
  }>, {
15
+ modelValue: LktObject;
16
+ column: Column;
15
17
  columns: Column[];
16
18
  i: number;
17
- column: Column;
18
- modelValue: LktObject;
19
19
  editModeEnabled: boolean;
20
20
  hasInlineEditPerm: boolean;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -28,43 +28,43 @@ type __VLS_Props = {
28
28
  declare function __VLS_template(): any;
29
29
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
30
30
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
- show: (...args: any[]) => void;
32
- click: (...args: any[]) => void;
33
31
  "update:modelValue": (...args: any[]) => void;
32
+ click: (...args: any[]) => void;
33
+ show: (...args: any[]) => void;
34
34
  "item-up": (...args: any[]) => void;
35
35
  "item-down": (...args: any[]) => void;
36
36
  "item-drop": (...args: any[]) => void;
37
37
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
38
- onShow?: ((...args: any[]) => any) | undefined;
39
- onClick?: ((...args: any[]) => any) | undefined;
40
38
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
39
+ onClick?: ((...args: any[]) => any) | undefined;
40
+ onShow?: ((...args: any[]) => any) | undefined;
41
41
  "onItem-up"?: ((...args: any[]) => any) | undefined;
42
42
  "onItem-down"?: ((...args: any[]) => any) | undefined;
43
43
  "onItem-drop"?: ((...args: any[]) => any) | undefined;
44
44
  }>, {
45
- i: number;
46
45
  sortable: boolean;
47
46
  modelValue: LktObject;
48
- rowDisplayType: ValidTableRowTypeValue;
49
- renderDrag: boolean | Function;
50
- disabledDrag: boolean | Function;
51
- dropText: string;
52
- dropIcon: string;
53
- editText: string;
54
- editIcon: string;
55
- editLink: string;
56
- dropConfirm: string;
57
- dropResource: string;
58
- addNavigation: boolean;
47
+ i: number;
59
48
  editModeEnabled: boolean;
60
49
  isDraggable: boolean;
61
50
  displayHiddenColumnsIndicator: boolean;
62
51
  hiddenIsVisible: boolean;
52
+ addNavigation: boolean;
63
53
  latestRow: boolean;
64
54
  canDrop: boolean;
65
55
  canEdit: boolean;
66
56
  visibleColumns: Column[];
67
57
  emptyColumns: string[];
58
+ dropConfirm: string;
59
+ dropText: string;
60
+ dropIcon: string;
61
+ dropResource: string;
62
+ editText: string;
63
+ editIcon: string;
64
+ editLink: string;
65
+ rowDisplayType: ValidTableRowTypeValue;
66
+ renderDrag: boolean | Function;
67
+ disabledDrag: boolean | Function;
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
69
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
70
70
  export default _default;
@@ -1,4 +1,4 @@
1
- import { Column, ColumnConfig, LktObject } from "lkt-vue-kernel";
1
+ import { Column, ColumnConfig, LktObject, SortDirection } from "lkt-vue-kernel";
2
2
  /**
3
3
  *
4
4
  * @param data
@@ -12,7 +12,7 @@ export declare const createColumn: (data: ColumnConfig) => Column;
12
12
  * @param sortDirection
13
13
  * @returns {number}
14
14
  */
15
- export declare const defaultTableSorter: (a: any, b: any, c: Column, sortDirection: string) => number;
15
+ export declare const defaultTableSorter: (a: any, b: any, c: Column, sortDirection: SortDirection) => number;
16
16
  /**
17
17
  *
18
18
  * @param column
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "1.4.2",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -37,11 +37,11 @@
37
37
  "@babel/types": "^7.23.6",
38
38
  "@types/node": "^20.11.19",
39
39
  "@types/rollup": "^0.54.0",
40
- "@vitejs/plugin-vue": "^5.0.4",
40
+ "@vitejs/plugin-vue": "^5.2.1",
41
41
  "rollup": "^4.9.6",
42
42
  "typescript": "^5.7",
43
- "vite": "^5.1.3",
44
- "vue-tsc": "^2.0"
43
+ "vite": "^5.4.14",
44
+ "vue-tsc": "^2.2"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=18"
@@ -1,30 +1,23 @@
1
1
  <script setup lang="ts">
2
2
  import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
- import {LktObject, ModalConfig} from "lkt-vue-kernel";
4
+ import {ButtonConfig, LktObject} from "lkt-vue-kernel";
5
5
 
6
6
  const emit = defineEmits(['click', 'append']);
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
+ config?: ButtonConfig
9
10
  disabled?: boolean
10
- text?: string
11
- icon?: string
12
- to?: string
13
- modal?: string
14
- modalData?: Partial<ModalConfig>
15
11
  }>(), {
12
+ config: undefined,
16
13
  disabled: false,
17
- text: '',
18
- icon: '',
19
- to: '',
20
- modal: '',
21
14
  });
22
15
 
23
16
  const hasCreateButtonSlot = computed(() => Settings.createButtonSlot !== ''),
24
17
  createButtonSlot = computed(() => Settings.createButtonSlot);
25
18
 
26
19
  const calculatedModalData = {
27
- ...props.modalData,
20
+ ...props.config?.modalData,
28
21
  beforeClose: (data: LktObject) => {
29
22
  // Checks lkt-item-crud as modal flow
30
23
  if ('itemCreated' in data && data.itemCreated === true) {
@@ -33,8 +26,13 @@ const calculatedModalData = {
33
26
  }
34
27
  };
35
28
 
29
+ const calculatedConfig = {
30
+ ...props.config,
31
+ }
32
+ calculatedConfig.modalData = calculatedModalData;
33
+
36
34
  const onClick = () => {
37
- if (!props.modal) {
35
+ if (!props.config?.modal) {
38
36
  emit('click');
39
37
  return;
40
38
  }
@@ -43,13 +41,8 @@ const onClick = () => {
43
41
 
44
42
  <template>
45
43
  <lkt-button
46
- palette="table-create"
44
+ v-bind="calculatedConfig"
47
45
  :disabled="disabled"
48
- :icon="hasCreateButtonSlot ? '' : icon"
49
- :text="hasCreateButtonSlot ? '' : text"
50
- :modal="modal"
51
- :modal-data="calculatedModalData"
52
- :on-click-to="to"
53
46
  @click="onClick">
54
47
  <template v-if="hasCreateButtonSlot">
55
48
  <component