hl-core 0.0.9-beta.32 → 0.0.9-beta.32-test

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,49 +1,57 @@
1
1
  <template>
2
- <div v-if="block" class="form-data-block rounded-lg border-[1px] relative transition-all" :class="[$styles.whiteBg, block.disabled && $styles.disabled]">
3
- <div class="py-3 px-6">
4
- <div class="flex items-center justify-between">
5
- <p :class="[$styles.textTitle, $styles.greenText]">{{ block.title }}</p>
6
- <div
7
- v-if="typeof block.headerBtn === 'object'"
8
- :class="[$styles.blueBg, $styles.whiteText, $styles.textSimple, block.disabled ? $styles.disabled : 'cursor-pointer']"
9
- class="hidden lg:flex transition-all rounded-lg h-[36px] items-center font-medium justify-center opacity-50 hover:opacity-90 w-[120px]"
10
- @click="!block.disabled && block.headerBtn.action()"
11
- >
12
- {{ block.headerBtn.text }}
13
- </div>
14
- </div>
15
- <p v-if="block.subtitle" :class="[$styles.greyText, $styles.textSimple]">{{ block.subtitle }}</p>
16
- <v-row class="mt-1 max-w-[97%]">
17
- <v-col v-for="(label, index) in visibleLabels" :key="index" :cols="block.shrinkLabels === true ? false : label.size">
18
- <p :class="[$styles.textSimple]" class="font-medium">
19
- {{ label.text }}
20
- </p>
21
- </v-col>
22
- </v-row>
23
- <div v-if="hasBlockData(block.data)">
24
- <v-row v-for="(row, index) in getBlockDataValue(block.data)" :key="index" class="min-h-[65px] max-w-[97%]">
25
- <v-col
26
- v-if="row.every((i: any) => !!i)"
27
- v-for="each of row.filter((_: any, i: number) => $display().lgAndUp.value ? true : block.labels[i].hideOnMobile === false)"
28
- :key="each"
29
- >
30
- <p :class="[$styles.textSimple]">
31
- {{ each }}
32
- </p>
33
- </v-col>
34
- <v-col v-else :class="[$styles.textSimple, $styles.blueText]">{{ block.noValueText ?? $dataStore.t('clients.necessaryFillForm') }}</v-col>
2
+ <base-animation :type="animation">
3
+ <div
4
+ v-if="block && !!block.show === true"
5
+ class="form-data-block rounded-lg border-[1px] relative transition-all"
6
+ :class="[$styles.whiteBg, block.disabled && $styles.disabled]"
7
+ >
8
+ <div class="py-3 px-6">
9
+ <div class="flex items-center justify-between">
10
+ <p :class="[$styles.textTitle, $styles.greenText]">{{ block.title }}</p>
35
11
  <div
36
- v-if="block.btn"
37
- class="absolute right-0 rounded-br-lg transition-all h-[70px] w-[60px] place-self-end flex items-center justify-center"
38
- :class="[$styles.blueBgLight, $styles.blueBgLightHover, block.disabled ? $styles.disabled : 'cursor-pointer']"
39
- @click="!block.disabled && block.btn.action({ value: row, index: index })"
12
+ v-if="typeof block.headerBtn === 'object'"
13
+ :class="[$styles.blueBg, $styles.whiteText, $styles.textSimple, block.disabled ? $styles.disabled : 'cursor-pointer']"
14
+ class="hidden lg:flex transition-all rounded-lg h-[36px] items-center font-medium justify-center opacity-50 hover:opacity-90 w-[120px]"
15
+ @click="!block.disabled && block.headerBtn.action()"
40
16
  >
41
- <i class="mdi text-xl" :class="[block.btn.icon]"></i>
17
+ {{ block.headerBtn.text }}
42
18
  </div>
19
+ </div>
20
+ <p v-if="block.subtitle" :class="[$styles.greyText, $styles.textSimple]">{{ block.subtitle }}</p>
21
+ <v-row class="mt-1 max-w-[97%]">
22
+ <v-col v-for="(label, index) in visibleLabels" :key="index" :cols="block.shrinkLabels === true ? false : label.size">
23
+ <p :class="[$styles.textSimple]" class="font-medium">
24
+ {{ label.text }}
25
+ </p>
26
+ </v-col>
43
27
  </v-row>
28
+ <div v-if="hasBlockData(block.data)">
29
+ <v-row v-for="(row, index) in getBlockDataValue(block.data)" :key="index" class="min-h-[65px] max-w-[97%]">
30
+ <v-col
31
+ v-if="row.every((i: any) => !!i)"
32
+ v-for="each of row.filter((_: any, i: number) => $display().lgAndUp.value ? true : block.labels[i].hideOnMobile === false)"
33
+ :key="each"
34
+ >
35
+ <p :class="[$styles.textSimple]">
36
+ {{ each }}
37
+ </p>
38
+ </v-col>
39
+ <v-col v-else :class="[$styles.textSimple, $styles.blueText]">{{ block.noValueText ?? $dataStore.t('clients.necessaryFillForm') }}</v-col>
40
+ <base-animation type="fade">
41
+ <div
42
+ v-if="block.btn && !!block.btn.showBtn === true"
43
+ class="absolute right-0 rounded-br-lg transition-all h-[70px] w-[60px] place-self-end flex items-center justify-center"
44
+ :class="[$styles.blueBgLight, $styles.blueBgLightHover, block.disabled ? $styles.disabled : 'cursor-pointer']"
45
+ @click="!block.disabled && block.btn.action({ value: row, index: index })"
46
+ >
47
+ <i class="mdi text-xl" :class="[block.btn.icon]"></i>
48
+ </div>
49
+ </base-animation>
50
+ </v-row>
51
+ </div>
44
52
  </div>
45
53
  </div>
46
- </div>
54
+ </base-animation>
47
55
  </template>
48
56
 
49
57
  <script lang="ts">
@@ -56,6 +64,10 @@ export default defineComponent({
56
64
  type: Object as PropType<FormBlock>,
57
65
  required: true,
58
66
  },
67
+ animation: {
68
+ type: String as PropType<VuetifyAnimations>,
69
+ required: false,
70
+ },
59
71
  },
60
72
  setup(props) {
61
73
  const display = useDisplayInfo();
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <component v-if="!!type && Object.keys(vuetifyAnimations).includes(type)" :is="vuetifyAnimations[type]">
3
+ <slot></slot>
4
+ </component>
5
+ <slot v-else></slot>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ defineProps({
10
+ type: {
11
+ type: String as PropType<VuetifyAnimations>,
12
+ required: false,
13
+ },
14
+ });
15
+
16
+ const vuetifyAnimations: { [key in VuetifyAnimations]: string } = {
17
+ expand: 'v-expand-transition',
18
+ fab: 'v-fab-transition',
19
+ fade: 'v-fade-transition',
20
+ scale: 'v-scale-transition',
21
+ 'scroll-x': 'v-scroll-x-transition',
22
+ 'scroll-y': 'v-scroll-x-transition',
23
+ 'slide-x': 'v-slide-x-transition',
24
+ 'slide-x-r': 'v-slide-x-reverse-transition',
25
+ 'slide-y': 'v-slide-y-transition',
26
+ 'slide-y-r': 'v-slide-y-reverse-transition',
27
+ };
28
+ </script>
@@ -226,8 +226,10 @@ export class FormBlock {
226
226
  data: ComputedRefWithControl<any> | string[][];
227
227
  shrinkLabels: boolean = true;
228
228
  disabled: ComputedRef;
229
+ show: ComputedRef;
229
230
  btn: {
230
231
  icon: string;
232
+ showBtn: ComputedRef;
231
233
  action: ({ value, index }: { value: any; index: number }) => void;
232
234
  };
233
235
  constructor(options: {
@@ -238,8 +240,9 @@ export class FormBlock {
238
240
  labels: FormBlockLabel[];
239
241
  data: ComputedRefWithControl<any> | string[][];
240
242
  shrinkLabels?: boolean;
241
- disabled: ComputedRef;
242
- btn?: { icon?: string; action: ({ value, index }: { value: any; index: number }) => void };
243
+ disabled?: ComputedRef;
244
+ show?: ComputedRef;
245
+ btn?: { icon?: string; showBtn?: ComputedRef; action: ({ value, index }: { value: any; index: number }) => void };
243
246
  }) {
244
247
  this.title = options.title;
245
248
  if (typeof options.subtitle === 'string') this.subtitle = options.subtitle;
@@ -248,11 +251,14 @@ export class FormBlock {
248
251
  this.labels = options.labels;
249
252
  this.data = options.data;
250
253
  if (typeof options.shrinkLabels === 'boolean') this.shrinkLabels = options.shrinkLabels;
251
- this.disabled = options.disabled;
254
+ if (options.disabled !== undefined) this.disabled = options.disabled;
255
+ else this.disabled = computed(() => false);
256
+ if (options.show !== undefined) this.show = options.show;
257
+ else this.show = computed(() => true);
252
258
  if (typeof options.headerBtn === 'object') this.headerBtn = options.headerBtn;
253
259
  if (typeof options.btn === 'object') {
254
- this.btn = { icon: options.btn.icon ?? 'mdi-dots-vertical', action: options.btn.action };
255
- } else this.btn = { icon: 'mdi-dots-vertical', action: () => {} };
260
+ this.btn = { icon: options.btn.icon ?? 'mdi-dots-vertical', showBtn: options.btn.showBtn ?? computed(() => true), action: options.btn.action };
261
+ } else this.btn = { icon: 'mdi-dots-vertical', showBtn: computed(() => true), action: () => {} };
256
262
  }
257
263
  }
258
264
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.32",
3
+ "version": "0.0.9-beta.32-test",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -66,6 +66,6 @@
66
66
  "vue-json-pretty": "2.2.4",
67
67
  "vue-toastification": "2.0.0-rc.5",
68
68
  "vue-uuid": "3.0.0",
69
- "vuetify": "3.3.11"
69
+ "vuetify": "3.3.23"
70
70
  }
71
71
  }
package/types/index.ts CHANGED
@@ -651,4 +651,6 @@ declare global {
651
651
  };
652
652
 
653
653
  type LabelSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
654
+
655
+ type VuetifyAnimations = 'expand' | 'fab' | 'fade' | 'scale' | 'scroll-x' | 'scroll-y' | 'slide-x' | 'slide-x-r' | 'slide-y' | 'slide-y-r';
654
656
  }