admins-components 1.2.0 → 1.2.1

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.
Files changed (59) hide show
  1. package/dist/admins-components.css +1 -0
  2. package/dist/admins-components.js +959 -0
  3. package/dist/admins-components.umd.cjs +1 -0
  4. package/package.json +17 -1
  5. package/admins-components/.vscode/extensions.json +0 -3
  6. package/admins-components/README.md +0 -5
  7. package/admins-components/index.html +0 -13
  8. package/admins-components/package.json +0 -21
  9. package/admins-components/public/vite.svg +0 -1
  10. package/admins-components/src/App.vue +0 -30
  11. package/admins-components/src/assets/vue.svg +0 -1
  12. package/admins-components/src/components/HelloWorld.vue +0 -41
  13. package/admins-components/src/main.ts +0 -5
  14. package/admins-components/src/style.css +0 -79
  15. package/admins-components/src/vite-env.d.ts +0 -1
  16. package/admins-components/tsconfig.app.json +0 -14
  17. package/admins-components/tsconfig.json +0 -7
  18. package/admins-components/tsconfig.node.json +0 -24
  19. package/admins-components/vite.config.ts +0 -7
  20. package/index.html +0 -13
  21. package/src/App.vue +0 -5
  22. package/src/assets/dropdown.scss +0 -61
  23. package/src/assets/dropdowncallback.scss +0 -57
  24. package/src/assets/dropdownmenu.scss +0 -33
  25. package/src/assets/filtercompact.scss +0 -6
  26. package/src/assets/filtercontrol.scss +0 -23
  27. package/src/assets/iconbutton.scss +0 -31
  28. package/src/assets/main.scss +0 -38
  29. package/src/assets/paginatorcontrol.scss +0 -16
  30. package/src/assets/propertyselector.scss +0 -12
  31. package/src/assets/tabletolist.scss +0 -115
  32. package/src/assets/tabletolistoptions.scss +0 -22
  33. package/src/assets/textlistbox.scss +0 -16
  34. package/src/assets/toastcomponent.scss +0 -23
  35. package/src/components/CheckBox.vue +0 -25
  36. package/src/components/CheckBoxList.vue +0 -48
  37. package/src/components/DropDown.vue +0 -203
  38. package/src/components/DropDownCallBack.vue +0 -109
  39. package/src/components/DropDownMenu.vue +0 -88
  40. package/src/components/FilterCompact.vue +0 -146
  41. package/src/components/FilterControl.vue +0 -133
  42. package/src/components/IconButton.vue +0 -25
  43. package/src/components/PaginatorControl.vue +0 -82
  44. package/src/components/RadioButton.vue +0 -21
  45. package/src/components/RadioButtonGroup.vue +0 -28
  46. package/src/components/SpinningProgress.vue +0 -9
  47. package/src/components/TableToList.vue +0 -281
  48. package/src/components/TableToListOptions.vue +0 -99
  49. package/src/components/TextListBox.vue +0 -50
  50. package/src/components/ToastComponent.vue +0 -82
  51. package/src/components/ToastWrapper.vue +0 -44
  52. package/src/index.ts +0 -56
  53. package/src/main.ts +0 -5
  54. package/src/style.css +0 -79
  55. package/src/vite-env.d.ts +0 -1
  56. package/tsconfig.app.json +0 -14
  57. package/tsconfig.json +0 -7
  58. package/tsconfig.node.json +0 -24
  59. package/vite.config.ts +0 -49
@@ -1,281 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, ref, type Ref } from "vue";
3
- import type { IFilterItem } from "./FilterControl.vue";
4
- import FilterControl from "./FilterControl.vue";
5
- import FilterCompact from "./FilterCompact.vue";
6
- import DropDownMenu from "./DropDownMenu.vue";
7
- import IconButton from "./IconButton.vue";
8
- import DropDownCallBack, {
9
- type DropDownCallBackItem,
10
- } from "./DropDownCallBack.vue";
11
- import PaginatorControl, {
12
- type PaginatorSettings,
13
- } from "./PaginatorControl.vue";
14
-
15
- const props = defineProps<{ items: any[]; config: TableToListConfig }>();
16
-
17
- defineEmits<{
18
- (e: "pagesize", value: number): void;
19
- (e: "page", value: number): void;
20
- }>();
21
-
22
- const visibleColumns = computed(() =>
23
- props.config.columns.filter((c) => c.visible != false)
24
- );
25
-
26
- const visibleColumnsFilters = computed(() =>
27
- props.config.columns.filter((c) => c.visible != false && c.filter)
28
- );
29
-
30
- const activeFilters = computed(() =>
31
- visibleColumns.value.filter(
32
- (c) => c.sort && c.sort.active && c.sort.active.value
33
- )
34
- );
35
-
36
- const propCountPerCardColumn = computed(() => {
37
- return Math.ceil(visibleColumns.value.length / props.config.smColCount);
38
- });
39
-
40
- const getCurrColumn = (propPosInCardColumn: number, cardColPos: number) => {
41
- // unfortunately v-for count started from 1, therefore incoming numbers are not indexes (0 based), but postions (1 based)
42
- var propIndex =
43
- propPosInCardColumn -
44
- 1 +
45
- (cardColPos - 1) * propCountPerCardColumn.value;
46
-
47
- return propIndex < visibleColumns.value.length
48
- ? visibleColumns.value[propIndex]
49
- : null;
50
- };
51
-
52
- const getConvertedValue = (col: Column, item: any) => {
53
- return col.converter
54
- ? col.converter!(item[col.property], item)
55
- : item[col.property];
56
- };
57
-
58
- const doSort = (col: Column) => {
59
- if (col.sort && col.sort.active) {
60
- let dst = !col.sort.active.value;
61
-
62
- props.config.columns.forEach((c) => {
63
- if (c.sort && c.sort.active) c.sort.active.value = false;
64
- });
65
-
66
- col.sort.active.value = dst;
67
- col.sort.callback(dst ? col.property : "");
68
- }
69
- };
70
- </script>
71
-
72
- <template>
73
- <div class="t2l-table-view t2l-table-header-label">
74
- <span class="t2l-select" v-if="config.selectableId"></span>
75
- <!-- render each property as a cell -->
76
- <span class="t2l-cell" v-for="vc in visibleColumns" :key="vc.property">
77
- <IconButton
78
- v-if="vc.sort"
79
- :icon="vc.sort!.icon"
80
- @click="doSort(vc)"
81
- :active="vc.sort?.active?.value"
82
- ></IconButton>
83
- {{ vc.label }}
84
- </span>
85
- <!-- render action header if defined -->
86
- <span class="t2l-cell" v-if="config.actionHeader">
87
- {{ config.actionHeader }}
88
- </span>
89
- </div>
90
- <div class="t2l-table-view t2l-table-header-filter">
91
- <!-- render if selectable -->
92
- <span class="t2l-select" v-if="config.selectableId"> </span>
93
-
94
- <!-- render each property as a cell -->
95
- <span class="t2l-cell" v-for="col in visibleColumns" :key="col.label">
96
- <template v-if="col.filter">
97
- <FilterControl :item="col.filter"></FilterControl>
98
- </template>
99
- </span>
100
- <!-- render action header empty if defined -->
101
- <span class="t2l-cell" v-if="config.actionHeader"> </span>
102
- </div>
103
- <div class="t2l-table-view t2l-rows">
104
- <!-- render all items -->
105
- <template v-for="item in items" :key="item">
106
- <div class="t2l-row">
107
- <div v-if="config.selectableId" class="t2l-select">
108
- <input
109
- class="form-check-input"
110
- type="checkbox"
111
- :id="item[config.selectableId!]"
112
- @change="item.selected = !item.selected"
113
- />
114
- </div>
115
-
116
- <!-- render values -->
117
- <div
118
- class="t2l-cell"
119
- v-for="col in visibleColumns"
120
- :key="col.property"
121
- v-html="getConvertedValue(col, item)"
122
- ></div>
123
- <!-- redner actions -->
124
- <div v-if="config.actions" class="t2l-cell t2l-actions">
125
- <template v-for="ac in config.actions" :key="ac">
126
- <button
127
- type="button"
128
- class="btn btn-outline-secondary"
129
- :title="ac.label"
130
- :disabled="!ac.enabled(item)"
131
- @click="ac.command(item)"
132
- >
133
- <i :class="ac.icon"></i>
134
- </button>
135
- </template>
136
- </div>
137
- </div>
138
- </template>
139
- </div>
140
-
141
- <div class="t2l-card-view t2l-card-filters">
142
- <!-- select order dropdown -->
143
- <div class="t2l-card-filter-order">
144
- <DropDownCallBack
145
- id="card-filter-order"
146
- :default="
147
- {
148
- icon: 'fa-solid fa-chevron-down',
149
- label: 'rendezés',
150
- } as DropDownCallBackItem
151
- "
152
- :selected="
153
- activeFilters.length > 0 ? activeFilters[0].property : ''
154
- "
155
- :enabled="config.sortEnabled"
156
- :options="
157
- ref(
158
- visibleColumns
159
- .filter((i) => i.sort)
160
- .map((i) => {
161
- const ret = {
162
- icon: i.sort!.icon,
163
- label: i.sort!.label,
164
- value: i.property,
165
- callback: i.sort!.callback,
166
- };
167
-
168
- return ret;
169
- }),
170
- ) as Ref<DropDownCallBackItem[]>
171
- "
172
- ></DropDownCallBack>
173
- </div>
174
- <!-- filter value selector -->
175
- <div class="t2l-card-filter-search">
176
- <FilterCompact
177
- :items="
178
- visibleColumnsFilters.map((i) => {
179
- return {
180
- filter: i.filter!,
181
- icon: i.filterIcon,
182
- label: i.label,
183
- };
184
- }) as any[]
185
- "
186
- ></FilterCompact>
187
- </div>
188
- </div>
189
- <div class="t2l-card-view t2l-rows">
190
- <div class="t2l-row" v-for="(item, index) in items" :key="index">
191
- <div class="t2l-card-select" v-if="config.selectableId">
192
- <input
193
- class="form-check-input"
194
- type="checkbox"
195
- :id="item[config.selectableId!]"
196
- @change="item.selected = !item.selected"
197
- />
198
- </div>
199
- <div
200
- class="t2l-card-col"
201
- v-for="cardColumnIndex in config.smColCount"
202
- :key="cardColumnIndex"
203
- >
204
- <template v-for="pn in propCountPerCardColumn" :key="pn">
205
- <div
206
- class="t2l-property"
207
- v-if="getCurrColumn(pn, cardColumnIndex)"
208
- >
209
- <span class="t2l-label">{{
210
- getCurrColumn(pn, cardColumnIndex)!.label
211
- }}</span>
212
- <div
213
- v-html="getConvertedValue(getCurrColumn(pn, cardColumnIndex)!, item)"
214
- ></div>
215
- </div>
216
- </template>
217
- </div>
218
- <div class="d-flex align-items-center">
219
- <DropDownMenu
220
- v-if="props.config.actions"
221
- :item="item"
222
- :options="props.config.actions"
223
- label="..."
224
- :id="index.toString()"
225
- :right="true"
226
- ></DropDownMenu>
227
- </div>
228
- </div>
229
- </div>
230
-
231
- <PaginatorControl
232
- v-if="config.paginatorSettings"
233
- :settings="config.paginatorSettings"
234
- @pagesize="$emit('pagesize', $event)"
235
- @page="$emit('page', $event)"
236
- ></PaginatorControl>
237
-
238
- <div
239
- class="d-flex justify-content-center t2l-footer"
240
- v-if="!config.paginatorSettings"
241
- >
242
- Elemek: {{ props.items.length }}
243
- </div>
244
- </template>
245
-
246
- <script lang="ts">
247
- export interface TableToListConfig {
248
- selectableId?: string | undefined;
249
- columns: Column[];
250
- smColCount: number;
251
- sortEnabled: boolean;
252
-
253
- actions?: Action[] | undefined;
254
- actionHeader?: string | undefined;
255
- paginatorSettings?: Ref<PaginatorSettings> | undefined;
256
- }
257
-
258
- export interface Column {
259
- visible?: boolean | undefined;
260
- label: string;
261
- filter: IFilterItem | undefined;
262
- filterIcon: string | undefined;
263
- property: string;
264
- sort?: undefined | Sort;
265
- converter: undefined | ((v: any, item: any) => any);
266
- }
267
-
268
- export interface Sort {
269
- label: string;
270
- icon: string;
271
- active: Ref<boolean> | undefined;
272
- callback: (property: string) => any;
273
- }
274
-
275
- export interface Action {
276
- icon: string;
277
- label: string;
278
- enabled: (item: any) => boolean;
279
- command: (item: any) => any;
280
- }
281
- </script>
@@ -1,99 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, ref } from "vue";
3
- import CheckBox from "./CheckBox.vue";
4
-
5
- const props = defineProps<{
6
- colCount: number;
7
- options: TableToListColumnOptions[];
8
- }>();
9
-
10
- const items = ref([] as TableToListColumnOptions[]);
11
-
12
- onMounted(() => {
13
- items.value = props.options;
14
- validate();
15
- });
16
-
17
- const itemsPerCol = computed(() =>
18
- props.colCount != 0 ? Math.ceil(props.options.length / props.colCount) : 0
19
- );
20
-
21
- const getItem = (cp: number, ip: number) => {
22
- var item = props.options[(cp - 1) * itemsPerCol.value + ip - 1];
23
- return item;
24
- };
25
-
26
- const save = () => {
27
- emits("save", items.value);
28
- };
29
-
30
- const emits = defineEmits<{
31
- (e: "save", items: TableToListColumnOptions[]): void;
32
- }>();
33
-
34
- export interface TableToListColumnOptions {
35
- label: string;
36
- property: string;
37
- checked: boolean;
38
- }
39
-
40
- const open = ref(false);
41
-
42
- const disabled = ref(true);
43
- const validate = () => {
44
- disabled.value = items.value.filter((i) => i.checked).length <= 1;
45
- };
46
- </script>
47
- <template>
48
- <div class="d-flex flex flex-row">
49
- <div
50
- class="d-flex flex-row align-items-center gap-2 options-header justify-content-start"
51
- @click="open = !open"
52
- v-if="!open"
53
- >
54
- <i class="fa-solid fa-cog"></i>
55
- <div class="options-header-label">beállítások</div>
56
- </div>
57
-
58
- <div
59
- class="d-flex flex-column gap-2 options-body flex-grow-1"
60
- v-if="open"
61
- >
62
- <div class="options-header-label">Látható oszlopok</div>
63
- <div class="d-flex flex-row">
64
- <div
65
- class="d-flex flex-grow-1 flex-column"
66
- v-for="cp in colCount"
67
- :key="cp"
68
- >
69
- <template v-for="ip in itemsPerCol" :key="ip">
70
- <template v-if="getItem(cp, ip)">
71
- <CheckBox
72
- :id="getItem(cp, ip).property"
73
- :label="getItem(cp, ip).label"
74
- :checked="getItem(cp, ip).checked"
75
- @changed="
76
- items.find(
77
- (i) => i.property == $event.id
78
- )!.checked = $event.checked;
79
- validate();
80
- "
81
- ></CheckBox>
82
- </template>
83
- </template>
84
- </div>
85
-
86
- <div class="d-flex align-items-end">
87
- <button
88
- class="btn btn-outline-secondary"
89
- type="button"
90
- @click="save"
91
- :disabled="disabled"
92
- >
93
- <i class="fa-solid fa-save"></i>
94
- </button>
95
- </div>
96
- </div>
97
- </div>
98
- </div>
99
- </template>
@@ -1,50 +0,0 @@
1
- <script setup lang="ts">
2
- import IconButton from "./IconButton.vue";
3
-
4
- defineProps<{
5
- items: TextListBoxItem[];
6
- }>();
7
-
8
- defineEmits<{ (e: "deleted", id: string): void }>();
9
-
10
- export interface TextListBoxItem {
11
- id: string;
12
- label: string;
13
- hideDelete?: boolean;
14
- showId?: boolean;
15
- childrend: TextListBoxItem[] | undefined;
16
- }
17
- </script>
18
- <template>
19
- <div class="tlb-container d-flex flex-column flex-grow-1">
20
- <div class="d-flex flex-column" v-for="item in items" :key="item.id">
21
- <div class="d-flex flex-row tlb-item">
22
- <div
23
- class="d-flex flex-column flex-grow-1 flex-sm-row justify-content-between tlb-item"
24
- >
25
- <div class="d-flex flex-grow-1" :id="item.id">
26
- {{ item.label }}
27
- </div>
28
- <div class="d-flex id" v-if="item.showId">
29
- {{ item.id }}
30
- </div>
31
- </div>
32
- <IconButton
33
- v-if="!item.hideDelete"
34
- icon="fa-solid fa-trash"
35
- @click="$emit('deleted', item.id)"
36
- ></IconButton>
37
- </div>
38
- <div
39
- class="d-flex flex-row align-items-center tlb-children-container"
40
- >
41
- <TextListBox
42
- v-if="item.childrend"
43
- :items="item.childrend"
44
- :showId="item.showId"
45
- :hideDelete="item.hideDelete"
46
- ></TextListBox>
47
- </div>
48
- </div>
49
- </div>
50
- </template>
@@ -1,82 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref } from "vue";
3
-
4
- const props = defineProps<{
5
- defaultDisplayDuration: number;
6
- }>();
7
-
8
- const pollInterval = 500;
9
-
10
- const toasts = ref<Toast[]>([]);
11
-
12
- const addToast = (toast: Toast) => {
13
- if (!toast.displayDuration)
14
- toast.displayDuration = props.defaultDisplayDuration;
15
-
16
- toast.id = new Date();
17
-
18
- toasts.value.filter(function (t) {
19
- return t.id !== toast.id;
20
- });
21
-
22
- toasts.value.push(toast);
23
- };
24
-
25
- defineExpose({
26
- addToast,
27
- });
28
-
29
- export interface Toast {
30
- title: string;
31
- message: string;
32
- type: "info" | "success" | "warning" | "error";
33
- id?: Date;
34
- displayDuration?: number;
35
- }
36
- setInterval(() => {
37
- toasts.value = toasts.value.map((t) => {
38
- t.displayDuration! -= pollInterval;
39
- return t;
40
- });
41
- toasts.value = toasts.value.filter((t) => {
42
- return t.displayDuration! > 0;
43
- });
44
- }, pollInterval);
45
- </script>
46
- <template>
47
- <div
48
- v-if="toasts.length > 0"
49
- class="toast-container position-fixed bottom-0 start-50 translate-middle-x p-4 toast-zindex"
50
- >
51
- <div
52
- v-for="toast in toasts"
53
- :key="toast.message"
54
- class="toast d-block"
55
- :class="{
56
- 'toast-info': toast.type === 'info',
57
- 'toast-success': toast.type === 'success',
58
- 'toast-warning': toast.type === 'warning',
59
- 'toast-error': toast.type === 'error',
60
- }"
61
- role="alert"
62
- aria-live="assertive"
63
- aria-atomic="true"
64
- >
65
- <div class="toast-header">
66
- <!-- <img src="..." class="rounded me-2" alt="..." /> -->
67
- <strong class="me-auto">{{ toast.title }}</strong>
68
- <small class="text-body-secondary">{{
69
- toast.id!.toLocaleTimeString()
70
- }}</small>
71
- <button
72
- type="button"
73
- class="btn-close"
74
- data-bs-dismiss="toast"
75
- aria-label="Close"
76
- @click="toasts = toasts.filter((t) => t.id !== toast.id)"
77
- ></button>
78
- </div>
79
- <div class="toast-body" v-html="toast.message"></div>
80
- </div>
81
- </div>
82
- </template>
@@ -1,44 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted, onUnmounted, ref } from 'vue';
3
- import ToastComponent from './ToastComponent.vue';
4
-
5
- const toast = ref<typeof ToastComponent>();
6
-
7
- const listeners = [
8
- {
9
- id: 'toast-notification-message',
10
- handler: (e: Event) => {
11
- let error = (e as any).detail;
12
- toast.value!.addToast({
13
- title: error.title,
14
- message: error.message,
15
- type: error.severity,
16
- displayDuration: error.displayDuration,
17
- });
18
- },
19
- },
20
- {
21
- id: 'fetch-error',
22
- handler: (e: Event) => {
23
- let error = (e as any).detail;
24
- toast.value!.addToast({
25
- title: error.title,
26
- message: error.message,
27
- type: 'error',
28
- displayDuration: 10000,
29
- });
30
- },
31
- },
32
- ];
33
-
34
- onMounted(() => {
35
- listeners.forEach((l) => window.addEventListener(l.id, l.handler));
36
- });
37
-
38
- onUnmounted(() => {
39
- listeners.forEach((l) => window.removeEventListener(l.id, l.handler));
40
- });
41
- </script>
42
- <template>
43
- <ToastComponent ref="toast" :defaultDisplayDuration="5000"></ToastComponent>
44
- </template>
package/src/index.ts DELETED
@@ -1,56 +0,0 @@
1
- import "./assets/main.scss";
2
- import type { App } from "vue";
3
- import CheckBox from "./components/CheckBox.vue";
4
- import CheckBoxList from "./components/CheckBoxList.vue";
5
- import DropDown from "./components/DropDown.vue";
6
- import DropDownCallBack from "./components/DropDownCallBack.vue";
7
- import DropDownMenu from "./components/DropDownMenu.vue";
8
- import FilterCompact from "./components/FilterCompact.vue";
9
- import FilterControl from "./components/FilterControl.vue";
10
- import IconButton from "./components/IconButton.vue";
11
- import PaginatorControl from "./components/PaginatorControl.vue";
12
- import RadioButton from "./components/RadioButton.vue";
13
- import RadioButtonGroup from "./components/RadioButtonGroup.vue";
14
- import SpinningProgress from "./components/SpinningProgress.vue";
15
- import TableToList from "./components/TableToList.vue";
16
- import TextListBox from "./components/TextListBox.vue";
17
- import ToastComponent from "./components/ToastComponent.vue";
18
- import ToastWrapper from "./components/ToastWrapper.vue";
19
-
20
- export default {
21
- install(app: App) {
22
- app.component("CheckBox", CheckBox);
23
- app.component("CheckBoxList", CheckBoxList);
24
- app.component("DropDown", DropDown);
25
- app.component("DropDownMenu", DropDownMenu);
26
- app.component("DropDownCallBack", DropDownCallBack);
27
- app.component("FilterCompact", FilterCompact);
28
- app.component("FilterControl", FilterControl);
29
- app.component("IconButton", IconButton);
30
- app.component("PaginatorControl", PaginatorControl);
31
- app.component("RadioButton", RadioButton);
32
- app.component("RadioButtonGroup", RadioButtonGroup);
33
- app.component("SpinningProgress", SpinningProgress);
34
- app.component("TableToList", TableToList);
35
- app.component("TextListBox", TextListBox);
36
- app.component("ToastComponent", ToastComponent);
37
- app.component("ToastWrapper", ToastWrapper);
38
- },
39
- };
40
-
41
- export { CheckBox };
42
- export { CheckBoxList };
43
- export { DropDown };
44
- export { DropDownMenu };
45
- export { DropDownCallBack };
46
- export { FilterCompact };
47
- export { FilterControl };
48
- export { IconButton };
49
- export { PaginatorControl };
50
- export { RadioButton };
51
- export { RadioButtonGroup };
52
- export { SpinningProgress };
53
- export { TableToList };
54
- export { TextListBox };
55
- export { ToastComponent };
56
- export { ToastWrapper };
package/src/main.ts DELETED
@@ -1,5 +0,0 @@
1
- import { createApp } from 'vue'
2
- import './style.css'
3
- import App from './App.vue'
4
-
5
- createApp(App).mount('#app')