@tak-ps/vue-tabler 4.2.0 → 4.3.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v4.3.0
14
+
15
+ - :rocket: If breadcrumb context is not in the vue-router, call Window.Location
16
+
17
+ ### v4.2.1
18
+
19
+ - :rocket: Fix lints and checks
20
+
13
21
  ### v4.2.0
14
22
 
15
23
  - :tada: Add JSON Schema Component
@@ -6,7 +6,7 @@
6
6
  <li class='breadcrumb-item'>
7
7
  <a
8
8
  class='cursor-pointer'
9
- @click='router.push("/")'
9
+ @click='navigate("/")'
10
10
  >Home</a>
11
11
  </li>
12
12
  <li
@@ -21,16 +21,10 @@
21
21
  v-if='crumb_it === crumbs.length - 1'
22
22
  v-text='crumb'
23
23
  />
24
- <a
25
- v-else-if='normalize'
26
- class='cursor-pointer'
27
- @click='router.push("/" + crumbs.splice(0, crumb_it + 1).join("/").toLowerCase())'
28
- v-text='crumb'
29
- />
30
24
  <a
31
25
  v-else
32
26
  class='cursor-pointer'
33
- @click='router.push("/" + crumbs.splice(0, crumb_it + 1).join("/"))'
27
+ @click='navigate(resolvePath(crumb_it))'
34
28
  v-text='crumb'
35
29
  />
36
30
  </li>
@@ -52,6 +46,29 @@ const props = withDefaults(defineProps<BreadCrumbProps>(), {
52
46
  const router = useRouter()
53
47
  const route = useRoute()
54
48
 
49
+ const navigate = (url: string) => {
50
+ try {
51
+ const resolved = router.resolve(url);
52
+ if (resolved.matched.length > 0) {
53
+ router.push(url);
54
+ } else {
55
+ window.location.href = url;
56
+ }
57
+ } catch (e) {
58
+ window.location.href = url;
59
+ }
60
+ }
61
+
62
+ const resolvePath = (index: number) => {
63
+ const rawCrumbs = route.path.split('/').filter((c) => c.length);
64
+ const subset = rawCrumbs.slice(0, index + 1);
65
+ let path = '/' + subset.join('/');
66
+ if (props.normalize) {
67
+ path = path.toLowerCase();
68
+ }
69
+ return path;
70
+ }
71
+
55
72
  const crumbs = computed(() => {
56
73
  return route.path.split('/').filter((crumb: string) => {
57
74
  return crumb.length
@@ -27,19 +27,19 @@
27
27
  <div
28
28
  class='user-select-none'
29
29
  v-text='label'
30
- >
31
- </div>
30
+ />
32
31
 
33
- <div
34
- v-if='create'
35
- class='d-flex justify-content-center my-4'
36
- :class='{
37
- "my-4": !compact
38
- }'
39
- @click='emit("create")'
40
- >
41
- <div class='btn btn-primary'>
42
- <span>Create <span v-text='label' /></span>
32
+ <div
33
+ v-if='create'
34
+ class='d-flex justify-content-center my-4'
35
+ :class='{
36
+ "my-4": !compact
37
+ }'
38
+ @click='emit("create")'
39
+ >
40
+ <div class='btn btn-primary'>
41
+ <span>Create <span v-text='label' /></span>
42
+ </div>
43
43
  </div>
44
44
  </div>
45
45
  </div>
@@ -148,18 +148,16 @@ import {
148
148
  IconPlus,
149
149
  } from '@tabler/icons-vue';
150
150
  import BuilderEdit from './SchemaBuilderEdit.vue';
151
- import {
152
- TablerNone,
153
- TablerInput,
154
- TablerEnum,
155
- TablerToggle,
156
- TablerDelete
157
- } from '@tak-ps/vue-tabler';
151
+ import TablerNone from './None.vue';
152
+ import TablerInput from './input/Input.vue';
153
+ import TablerEnum from './input/Enum.vue';
154
+ import TablerToggle from './input/Toggle.vue';
155
+ import TablerDelete from './Delete.vue';
158
156
 
159
157
  interface SchemaProperty {
160
158
  name: string;
161
159
  type: string;
162
- required?: boolean;
160
+ required: boolean;
163
161
  description?: string;
164
162
  enum?: string[];
165
163
  _id?: string;
@@ -117,16 +117,14 @@ import {
117
117
  IconPlus,
118
118
  IconTrash
119
119
  } from '@tabler/icons-vue';
120
- import {
121
- TablerModal,
122
- TablerInput,
123
- TablerToggle
124
- } from '@tak-ps/vue-tabler';
120
+ import TablerModal from './Modal.vue';
121
+ import TablerInput from './input/Input.vue';
122
+ import TablerToggle from './input/Toggle.vue';
125
123
 
126
124
  interface SchemaProperty {
127
125
  name: string;
128
126
  type: string;
129
- required?: boolean;
127
+ required: boolean;
130
128
  description?: string;
131
129
  enum?: string[];
132
130
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "4.2.0",
4
+ "version": "4.3.0",
5
5
  "lib": "lib.ts",
6
6
  "main": "lib.ts",
7
7
  "module": "lib.ts",