@katlux/toolkit 0.1.0-beta.83 → 0.1.0-beta.84

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
3
  "configKey": "katluxToolkit",
4
- "version": "0.1.0-beta.83",
4
+ "version": "0.1.0-beta.84",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -8,10 +8,10 @@ const props = defineProps({
8
8
  selectedRows: { type: Array, required: true },
9
9
  selectAll: { type: Boolean, required: true }
10
10
  });
11
- const { selected, dp, doAction } = useKBulkActionsLogic(props);
11
+ const { selected, dp, doAction, visibleBulkActions } = useKBulkActionsLogic(props);
12
12
  const presetComponent = usePresetComponent("KBulkActions", KBulkActionsDefault);
13
13
  const templateProps = computed(() => ({
14
- bulkActions: props.bulkActions,
14
+ bulkActions: visibleBulkActions.value,
15
15
  selectedRows: props.selectedRows,
16
16
  selectAll: props.selectAll,
17
17
  selected: selected.value,
@@ -13,13 +13,16 @@ export declare function useKBulkActionsLogic(props: KBulkActionsProps): {
13
13
  icon?: string | undefined;
14
14
  iconOnly?: boolean | undefined;
15
15
  type?: "default" | "primary" | "danger" | "success" | "warning" | "info" | "light" | "dark" | undefined;
16
+ visible?: Function | undefined;
16
17
  } | null, IKDatatableAction | {
17
18
  action: Function;
18
19
  label: string;
19
20
  icon?: string | undefined;
20
21
  iconOnly?: boolean | undefined;
21
22
  type?: "default" | "primary" | "danger" | "success" | "warning" | "info" | "light" | "dark" | undefined;
23
+ visible?: Function | undefined;
22
24
  } | null>;
23
25
  dp: CFlatClientDataProvider;
24
26
  doAction: (action: any) => void;
27
+ visibleBulkActions: import("vue").ComputedRef<IKDatatableAction[]>;
25
28
  };
@@ -1,10 +1,16 @@
1
- import { ref, watch } from "vue";
1
+ import { ref, watch, computed } from "vue";
2
2
  import { CFlatClientDataProvider } from "@katlux/providers";
3
3
  export const KBulkActionsDefaultProps = {};
4
4
  export function useKBulkActionsLogic(props) {
5
5
  const selected = ref(null);
6
6
  const dp = new CFlatClientDataProvider();
7
- watch(() => props.bulkActions, (actions) => {
7
+ const visibleBulkActions = computed(() => {
8
+ return props.bulkActions.filter((action) => {
9
+ if (!action.visible) return true;
10
+ return action.visible(props.selectedRows, props.selectAll);
11
+ });
12
+ });
13
+ watch(visibleBulkActions, (actions) => {
8
14
  dp.setData(actions.map((row) => ({
9
15
  label: row.label,
10
16
  action: row.action
@@ -19,6 +25,7 @@ export function useKBulkActionsLogic(props) {
19
25
  return {
20
26
  selected,
21
27
  dp,
22
- doAction
28
+ doAction,
29
+ visibleBulkActions
23
30
  };
24
31
  }
@@ -122,12 +122,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
122
122
  }>, {
123
123
  label: string;
124
124
  isOpen: boolean;
125
+ day: string | Date;
125
126
  validation: "error" | "success" | "warning" | null | undefined;
126
127
  validationText: string;
127
128
  modelValue: string | Date;
128
129
  placeholder: string;
129
130
  teleportTo: string;
130
- day: string | Date;
131
131
  showClear: boolean;
132
132
  align: "left" | "right" | undefined;
133
133
  format: string;
@@ -122,12 +122,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
122
122
  }>, {
123
123
  label: string;
124
124
  isOpen: boolean;
125
+ day: string | Date;
125
126
  validation: "error" | "success" | "warning" | null | undefined;
126
127
  validationText: string;
127
128
  modelValue: string | Date;
128
129
  placeholder: string;
129
130
  teleportTo: string;
130
- day: string | Date;
131
131
  showClear: boolean;
132
132
  align: "left" | "right" | undefined;
133
133
  format: string;
@@ -128,12 +128,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
128
128
  }>, {
129
129
  label: string;
130
130
  isOpen: boolean;
131
+ day: string | Date;
131
132
  validation: "error" | "success" | "warning" | null | undefined;
132
133
  validationText: string;
133
134
  modelValue: string | Date;
134
135
  placeholder: string;
135
136
  teleportTo: string;
136
- day: string | Date;
137
137
  showClear: boolean;
138
138
  format: string;
139
139
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
@@ -128,12 +128,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
128
128
  }>, {
129
129
  label: string;
130
130
  isOpen: boolean;
131
+ day: string | Date;
131
132
  validation: "error" | "success" | "warning" | null | undefined;
132
133
  validationText: string;
133
134
  modelValue: string | Date;
134
135
  placeholder: string;
135
136
  teleportTo: string;
136
- day: string | Date;
137
137
  showClear: boolean;
138
138
  format: string;
139
139
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
@@ -1,5 +1,5 @@
1
1
  import type { IKDatatableAction } from '@katlux/providers';
2
- import type { ITreeViewColumn, IRowAction } from '../KTreeView/KTreeView.logic.js';
2
+ import type { ITreeViewColumn } from '../KTreeView/KTreeView.logic.js';
3
3
  /**
4
4
  * A single task (time block) assigned to a resource.
5
5
  * Resources can have multiple tasks displayed as bars on the timeline.
@@ -45,7 +45,7 @@ export interface KGanttProps {
45
45
  columns: ITreeViewColumn[];
46
46
  treeColumnIndex?: number;
47
47
  bulkActions?: IKDatatableAction[];
48
- rowActions?: IRowAction[];
48
+ rowActions?: IKDatatableAction[];
49
49
  startDate?: Date | string | number;
50
50
  endDate?: Date | string | number;
51
51
  /** @deprecated use startingPoint and endingPoint */
@@ -28,7 +28,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
28
28
  default: () => never[];
29
29
  };
30
30
  rowActions: {
31
- type: import("vue").PropType<import("./KTreeView.logic.js").IRowAction[]>;
31
+ type: import("vue").PropType<import("@katlux/providers").IKDatatableAction[]>;
32
32
  default: () => never[];
33
33
  };
34
34
  headerSlots: {
@@ -69,7 +69,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
69
69
  default: () => never[];
70
70
  };
71
71
  rowActions: {
72
- type: import("vue").PropType<import("./KTreeView.logic.js").IRowAction[]>;
72
+ type: import("vue").PropType<import("@katlux/providers").IKDatatableAction[]>;
73
73
  default: () => never[];
74
74
  };
75
75
  headerSlots: {
@@ -85,7 +85,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
85
85
  idKey: string;
86
86
  expandedByDefault: boolean;
87
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
88
- rowActions: import("./KTreeView.logic.js").IRowAction[];
88
+ rowActions: import("@katlux/providers").IKDatatableAction[];
89
89
  cellSlots: Record<string, any>;
90
90
  headerSlots: Record<string, any>;
91
91
  treeColumnIndex: number;
@@ -28,7 +28,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
28
28
  default: () => never[];
29
29
  };
30
30
  rowActions: {
31
- type: import("vue").PropType<import("./KTreeView.logic.js").IRowAction[]>;
31
+ type: import("vue").PropType<import("@katlux/providers").IKDatatableAction[]>;
32
32
  default: () => never[];
33
33
  };
34
34
  headerSlots: {
@@ -69,7 +69,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
69
69
  default: () => never[];
70
70
  };
71
71
  rowActions: {
72
- type: import("vue").PropType<import("./KTreeView.logic.js").IRowAction[]>;
72
+ type: import("vue").PropType<import("@katlux/providers").IKDatatableAction[]>;
73
73
  default: () => never[];
74
74
  };
75
75
  headerSlots: {
@@ -85,7 +85,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
85
85
  idKey: string;
86
86
  expandedByDefault: boolean;
87
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
88
- rowActions: import("./KTreeView.logic.js").IRowAction[];
88
+ rowActions: import("@katlux/providers").IKDatatableAction[];
89
89
  cellSlots: Record<string, any>;
90
90
  headerSlots: Record<string, any>;
91
91
  treeColumnIndex: number;
@@ -8,11 +8,6 @@ export interface ITreeViewColumn {
8
8
  componentProps?: any;
9
9
  width?: string;
10
10
  }
11
- export interface IRowAction {
12
- label: string;
13
- action: (row: any) => void;
14
- icon?: string;
15
- }
16
11
  export interface KTreeViewProps {
17
12
  dataProvider: ADataProvider;
18
13
  columns: ITreeViewColumn[];
@@ -20,7 +15,7 @@ export interface KTreeViewProps {
20
15
  parentKey: string;
21
16
  idKey: string;
22
17
  bulkActions?: IKDatatableAction[];
23
- rowActions?: IRowAction[];
18
+ rowActions?: IKDatatableAction[];
24
19
  expandedByDefault?: boolean;
25
20
  headerSlots?: Record<string, any>;
26
21
  cellSlots?: Record<string, any>;
@@ -55,7 +50,7 @@ export declare const KTreeViewDefaultProps: {
55
50
  default: () => never[];
56
51
  };
57
52
  rowActions: {
58
- type: PropType<IRowAction[]>;
53
+ type: PropType<IKDatatableAction[]>;
59
54
  default: () => never[];
60
55
  };
61
56
  headerSlots: {
@@ -35,21 +35,21 @@
35
35
  component(v-if="getCellSlot(visibleField)" :is="getCellSlot(visibleField)" :row="row" :field="visibleField" :value="row[visibleField]")
36
36
  span(v-else) {{ row[visibleField] }}
37
37
  td.rowAction(v-if="props.rowActions && props.rowActions.length>0")
38
- KTooltip(
39
- v-for="rowAction in props.rowActions"
40
- :key="rowAction.label"
41
- :text="rowAction.label"
42
- :disabled="!(rowAction.iconOnly || !!rowAction.icon)"
43
- )
44
- KButton(
45
- size="small"
46
- :type="rowAction.type || 'default'"
47
- :iconOnly="rowAction.iconOnly || !!rowAction.icon"
48
- @click="rowAction.action(row)"
38
+ template(v-for="rowAction in props.rowActions" :key="rowAction.label")
39
+ KTooltip(
40
+ v-if="!rowAction.visible || rowAction.visible(row)"
41
+ :text="rowAction.label"
42
+ :disabled="!(rowAction.iconOnly || !!rowAction.icon)"
49
43
  )
50
- template(#icon v-if="rowAction.icon")
51
- KIcon(:iconname="rowAction.icon" :width="16" :height="16")
52
- template(#default v-if="!rowAction.iconOnly && !rowAction.icon") {{rowAction.label}}
44
+ KButton(
45
+ size="small"
46
+ :type="rowAction.type || 'default'"
47
+ :iconOnly="rowAction.iconOnly || !!rowAction.icon"
48
+ @click="rowAction.action(row)"
49
+ )
50
+ template(#icon v-if="rowAction.icon")
51
+ KIcon(:iconname="rowAction.icon" :width="16" :height="16")
52
+ template(#default v-if="!rowAction.iconOnly && !rowAction.icon") {{rowAction.label}}
53
53
  .footer
54
54
  KBulkActions.bulk-actions(v-if="props.bulkActions && props.bulkActions.length>0" :bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll")
55
55
  KPagination.pagination(:dataProvider="props.dataProvider")
@@ -170,11 +170,18 @@ const isLoading = computed(() => {
170
170
  width: 30px;
171
171
  }
172
172
  .rowAction {
173
- width: 30px;
174
- }
175
- .rowAction {
176
- display: flex;
177
- gap: 10px;
173
+ width: 1%;
174
+ white-space: nowrap;
175
+
176
+ & > * {
177
+ display: inline-block;
178
+ margin-right: 10px;
179
+ vertical-align: middle;
180
+ }
181
+
182
+ & > *:last-child {
183
+ margin-right: 0;
184
+ }
178
185
  }
179
186
  .footer {
180
187
  display: flex;
@@ -1,4 +1,4 @@
1
- import type { ITreeViewColumn, IRowAction } from '#toolkit/components/KTreeView/KTreeView.logic';
1
+ import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
2
2
  import type { IKDatatableAction } from '@katlux/providers';
3
3
  import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic';
4
4
  type __VLS_Props = {
@@ -6,7 +6,7 @@ type __VLS_Props = {
6
6
  columns: ITreeViewColumn[];
7
7
  treeColumnIndex?: number;
8
8
  bulkActions?: IKDatatableAction[];
9
- rowActions?: IRowAction[];
9
+ rowActions?: IKDatatableAction[];
10
10
  globalDateRange: {
11
11
  start: number;
12
12
  end: number;
@@ -21,13 +21,13 @@
21
21
  )
22
22
  template(#cell-_ganttActions="{ row }")
23
23
  .gantt-actions
24
- KButton(
25
- v-for="rowAction in rowActions"
26
- :key="rowAction.label"
27
- :type="rowAction.type || 'default'"
28
- size="small"
29
- @click="rowAction.action(row)"
30
- ) {{ rowAction.label }}
24
+ template(v-for="rowAction in rowActions" :key="rowAction.label")
25
+ KButton(
26
+ v-if="!rowAction.visible || rowAction.visible(row)"
27
+ :type="rowAction.type || 'default'"
28
+ size="small"
29
+ @click="rowAction.action(row)"
30
+ ) {{ rowAction.label }}
31
31
  template(#header-ganttTimeline)
32
32
  KGanttRuler(
33
33
  :startMs="globalDateRange.start"
@@ -57,7 +57,7 @@
57
57
  import { computed, ref } from 'vue'
58
58
  import KGanttRuler from './KGanttRuler.vue'
59
59
  import KGanttTimeline from './KGanttTimeline.vue'
60
- import type { ITreeViewColumn, IRowAction } from '#toolkit/components/KTreeView/KTreeView.logic'
60
+ import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic'
61
61
  import type { IKDatatableAction } from '@katlux/providers'
62
62
  import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic'
63
63
  import { getSnapMs, isTaskOverlapping, calculateGanttMinWidth } from '#toolkit/components/KGantt/KGantt.logic'
@@ -67,7 +67,7 @@ const props = defineProps<{
67
67
  columns: ITreeViewColumn[]
68
68
  treeColumnIndex?: number
69
69
  bulkActions?: IKDatatableAction[]
70
- rowActions?: IRowAction[]
70
+ rowActions?: IKDatatableAction[]
71
71
 
72
72
  globalDateRange: { start: number, end: number }
73
73
  totalDuration: number
@@ -1,4 +1,4 @@
1
- import type { ITreeViewColumn, IRowAction } from '#toolkit/components/KTreeView/KTreeView.logic';
1
+ import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
2
2
  import type { IKDatatableAction } from '@katlux/providers';
3
3
  import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic';
4
4
  type __VLS_Props = {
@@ -6,7 +6,7 @@ type __VLS_Props = {
6
6
  columns: ITreeViewColumn[];
7
7
  treeColumnIndex?: number;
8
8
  bulkActions?: IKDatatableAction[];
9
- rowActions?: IRowAction[];
9
+ rowActions?: IKDatatableAction[];
10
10
  globalDateRange: {
11
11
  start: number;
12
12
  end: number;
@@ -1,11 +1,11 @@
1
- import type { ITreeViewColumn, IRowAction } from '../../../../components/KTreeView/KTreeView.logic.js';
1
+ import type { ITreeViewColumn } from '../../../../components/KTreeView/KTreeView.logic.js';
2
2
  import type { IKDatatableAction } from '@katlux/providers';
3
3
  type __VLS_Props = {
4
4
  dataProvider: any;
5
5
  columns: ITreeViewColumn[];
6
6
  treeColumnIndex?: number;
7
7
  bulkActions?: IKDatatableAction[];
8
- rowActions?: IRowAction[];
8
+ rowActions?: IKDatatableAction[];
9
9
  showCheckboxes: boolean;
10
10
  selectedRows: any[];
11
11
  selectAll: boolean;
@@ -24,7 +24,7 @@
24
24
  <script lang="ts" setup>
25
25
  import { computed } from 'vue'
26
26
  import KTreeCell from './KTreeCell.vue'
27
- import type { ITreeViewColumn, IRowAction } from '../../../../components/KTreeView/KTreeView.logic'
27
+ import type { ITreeViewColumn } from '../../../../components/KTreeView/KTreeView.logic'
28
28
  import type { IKDatatableAction } from '@katlux/providers'
29
29
 
30
30
  const props = defineProps<{
@@ -32,7 +32,7 @@ const props = defineProps<{
32
32
  columns: ITreeViewColumn[]
33
33
  treeColumnIndex?: number
34
34
  bulkActions?: IKDatatableAction[]
35
- rowActions?: IRowAction[]
35
+ rowActions?: IKDatatableAction[]
36
36
  showCheckboxes: boolean
37
37
  selectedRows: any[]
38
38
  selectAll: boolean
@@ -1,11 +1,11 @@
1
- import type { ITreeViewColumn, IRowAction } from '../../../../components/KTreeView/KTreeView.logic.js';
1
+ import type { ITreeViewColumn } from '../../../../components/KTreeView/KTreeView.logic.js';
2
2
  import type { IKDatatableAction } from '@katlux/providers';
3
3
  type __VLS_Props = {
4
4
  dataProvider: any;
5
5
  columns: ITreeViewColumn[];
6
6
  treeColumnIndex?: number;
7
7
  bulkActions?: IKDatatableAction[];
8
- rowActions?: IRowAction[];
8
+ rowActions?: IKDatatableAction[];
9
9
  showCheckboxes: boolean;
10
10
  selectedRows: any[];
11
11
  selectAll: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.0-beta.83",
3
+ "version": "0.1.0-beta.84",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "Apache-2.0",