@vc-shell/framework 1.0.111 → 1.0.112

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "main": "./dist/framework.mjs",
5
5
  "module": "./dist/framework.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -56,8 +56,8 @@
56
56
  "whatwg-fetch": "^3.6.2"
57
57
  },
58
58
  "devDependencies": {
59
- "@vc-shell/api-client-generator": "^1.0.111",
60
- "@vc-shell/config-generator": "^1.0.111",
59
+ "@vc-shell/api-client-generator": "^1.0.112",
60
+ "@vc-shell/config-generator": "^1.0.112",
61
61
  "@vitejs/plugin-vue": "^4.2.3",
62
62
  "sass": "^1.62.1",
63
63
  "typescript": "~5.0.4",
@@ -1,10 +1,8 @@
1
- import { h, resolveComponent, mergeProps, ExtractPropTypes, Component } from "vue";
1
+ import { h, resolveComponent, ExtractPropTypes, Component } from "vue";
2
2
  import { SelectField } from "../factories";
3
3
  import componentProps from "./props";
4
4
  import ValidationField from "./ValidationField";
5
5
  import { SelectSchema } from "../../types";
6
- import { unrefNested } from "../../helpers/unrefNested";
7
- import { getModel } from "../../helpers/getters";
8
6
 
9
7
  export default {
10
8
  name: "SelectField",
@@ -20,6 +18,7 @@ export default {
20
18
  options: props.bladeContext.scope[props.element.optionsMethod],
21
19
  currentLanguage: props.currentLocale,
22
20
  clearable: props.element.clearable || false,
21
+ searchable: props.element.searchable || false,
23
22
  },
24
23
  options: props.baseOptions,
25
24
 
@@ -27,7 +27,7 @@ const upsertHelper = (overrides: OverridesSchema, schemaCopy: { [key: string]: D
27
27
  index,
28
28
  path,
29
29
  value,
30
- id: overrideId,
30
+ id,
31
31
  }: {
32
32
  index: OverridesUpsert["index"];
33
33
  path: OverridesUpsert["path"];
@@ -57,7 +57,7 @@ const removeHelper = (overrides, schemaCopy: { [key: string]: DynamicSchema }) =
57
57
  const clonedSchema = _.cloneDeep(schema);
58
58
  overrides.remove
59
59
  .filter((x) => clonedSchema.settings.id === x.id)
60
- .forEach(({ path, id: overrideId }) => {
60
+ .forEach(({ path }) => {
61
61
  if (path) {
62
62
  const parentPath = path.slice(0, path.lastIndexOf("["));
63
63
  _.unset(clonedSchema, path);
@@ -66,7 +66,10 @@
66
66
  <!-- Empty template -->
67
67
  <template #empty>
68
68
  <template v-if="bladeOptions.empty">
69
- <component :is="bladeOptions.empty"></component>
69
+ <component
70
+ :is="bladeOptions.empty"
71
+ @add="openDetailsBlade"
72
+ ></component>
70
73
  </template>
71
74
  <template v-else>
72
75
  <div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center">
@@ -123,11 +126,11 @@ import {
123
126
  import { useI18n } from "vue-i18n";
124
127
  import { DynamicGridSchema, ListContentSchema } from "../types";
125
128
  import { useFilterBuilder } from "../composables";
126
- import * as _ from "lodash-es";
127
- import { useFunctions } from "../../../../core/composables";
128
- import { IBladeToolbar, ITableColumns } from "../../../../core/types";
129
- import { ListBladeContext, UseList, usePopup, ListBaseBladeScope } from "../../../index";
129
+ import { useFunctions, useNotifications } from "../../../../core/composables";
130
+ import { ITableColumns } from "../../../../core/types";
130
131
  import { toolbarReducer } from "../helpers/toolbarReducer";
132
+ import { notification, usePopup } from "../../../components";
133
+ import { ListBaseBladeScope, ListBladeContext, UseList } from "../factories/types";
131
134
 
132
135
  export interface Props {
133
136
  expanded?: boolean;
@@ -154,6 +157,7 @@ const props = withDefaults(defineProps<Props>(), {
154
157
  const { t } = useI18n({ useScope: "global" });
155
158
  const { showConfirmation } = usePopup();
156
159
  const { debounce } = useFunctions();
160
+
157
161
  const emit = defineEmits<Emits>();
158
162
 
159
163
  defineOptions({
@@ -169,6 +173,22 @@ const sort = ref("createdDate:DESC");
169
173
  const selectedIds = ref<string[]>([]);
170
174
  const isDesktop = inject<Ref<boolean>>("isDesktop");
171
175
 
176
+ const { moduleNotifications, markAsRead } = useNotifications(settings.value.pushNotificationType);
177
+
178
+ watch(
179
+ moduleNotifications,
180
+ (newVal) => {
181
+ newVal.forEach((message) => {
182
+ notification.success(message.title, {
183
+ onClose() {
184
+ markAsRead(message);
185
+ },
186
+ });
187
+ });
188
+ },
189
+ { deep: true }
190
+ );
191
+
172
192
  const tableData = computed(() => props.model?.content.find((type: ListContentSchema) => type.component === "vc-table"));
173
193
  const table = computed(() => {
174
194
  const tableScope = {
@@ -280,6 +300,16 @@ watch(
280
300
  { immediate: true }
281
301
  );
282
302
 
303
+ const openDetailsBlade = () => {
304
+ if (
305
+ "openDetailsBlade" in toValue(scope) &&
306
+ toValue(scope).openDetailsBlade &&
307
+ typeof toValue(scope).openDetailsBlade === "function"
308
+ ) {
309
+ toValue(scope).openDetailsBlade();
310
+ }
311
+ };
312
+
283
313
  const onItemClick = (item: { id: string }) => {
284
314
  if (
285
315
  "openDetailsBlade" in toValue(scope) &&
@@ -422,7 +452,7 @@ function templateOverrideComponents(): Record<string, VNode> {
422
452
 
423
453
  function resolveTemplateComponent(name: string) {
424
454
  if (!tableData.value) return;
425
- const componentName = tableData[name]?.component;
455
+ const componentName = tableData.value[name]?.component;
426
456
  if (componentName) {
427
457
  const component = resolveComponent(componentName);
428
458
 
@@ -79,6 +79,7 @@ export interface SettingsBase {
79
79
  * @description Blade permissions
80
80
  */
81
81
  permissions?: string | string[];
82
+ pushNotificationType?: string | string[];
82
83
  }
83
84
 
84
85
  export interface ListContentSchema extends SchemaBase {
@@ -140,6 +141,7 @@ export interface SelectSchema extends SchemaBase {
140
141
  };
141
142
  clearable?: boolean;
142
143
  emitValue?: boolean;
144
+ searchable?: boolean;
143
145
  }
144
146
 
145
147
  export interface InputSchema extends SchemaBase {
@@ -35,7 +35,6 @@
35
35
  :modules="modules"
36
36
  content-type="html"
37
37
  :read-only="disabled"
38
- :placeholder="placeholder"
39
38
  @update:content="onInput"
40
39
  />
41
40
  <slot
@@ -143,7 +143,7 @@
143
143
  >
144
144
  <div
145
145
  class="tw-flex tw-items-center tw-flex-nowrap tw-truncate tw-px-3"
146
- :class="tableAlignment[item.align as string]"
146
+ :class="tableAlignment[item.align]"
147
147
  >
148
148
  <div class="tw-truncate">
149
149
  <slot :name="`header_${item.id}`">{{ item.title }}</slot>