@vc-shell/create-vc-app 1.0.340 → 1.1.0-alpha.2

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 (84) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +30 -30
  3. package/dist/index.js +154 -186
  4. package/dist/templates/base/LICENSE +12 -12
  5. package/dist/templates/base/README.md +54 -54
  6. package/dist/templates/base/_browserslistrc +3 -3
  7. package/dist/templates/base/_commitlintrc.json +3 -3
  8. package/dist/templates/base/_editorconfig +22 -22
  9. package/dist/templates/base/_env +3 -3
  10. package/dist/templates/base/_env.local +1 -1
  11. package/dist/templates/base/_eslintignore +3 -3
  12. package/dist/templates/base/_eslintrc.js +41 -41
  13. package/dist/templates/base/_github/COMMIT_CONVENTION.md +91 -91
  14. package/dist/templates/base/_github/PULL_REQUEST_TEMPLATE.md +8 -8
  15. package/dist/templates/base/_gitignore +71 -71
  16. package/dist/templates/base/_husky/commit-msg +4 -4
  17. package/dist/templates/base/_husky/pre-commit +4 -4
  18. package/dist/templates/base/_package.json +5 -6
  19. package/dist/templates/base/_prettierignore +4 -4
  20. package/dist/templates/base/_prettierrc +4 -4
  21. package/dist/templates/base/_vscode/extensions.json +14 -14
  22. package/dist/templates/base/_vscode/settings.json +14 -14
  23. package/dist/templates/base/_yarn/releases/yarn-4.0.2.cjs +893 -893
  24. package/dist/templates/base/_yarnrc.yml +7 -7
  25. package/dist/templates/base/index.html +26 -26
  26. package/dist/templates/base/postcss.config.cjs +6 -6
  27. package/dist/templates/base/public/assets/app-select.svg +11 -11
  28. package/dist/templates/base/public/assets/logo-white.svg +21 -21
  29. package/dist/templates/base/public/assets/logo.svg +8 -8
  30. package/dist/templates/base/public/img/icons/safari-pinned-tab.svg +32 -32
  31. package/dist/templates/base/scripts/release.ts +18 -18
  32. package/dist/templates/base/src/api_client/README.md +78 -78
  33. package/dist/templates/base/src/composables/index.ts +1 -1
  34. package/dist/templates/base/src/env.d.ts +9 -9
  35. package/dist/templates/base/src/locales/en.json +3 -3
  36. package/dist/templates/base/src/locales/index.ts +2 -2
  37. package/dist/templates/base/src/router/index.ts +10 -10
  38. package/dist/templates/base/src/router/routes.ts +78 -78
  39. package/dist/templates/base/src/shims-vue.d.ts +63 -63
  40. package/dist/templates/base/src/styles/base.scss +38 -38
  41. package/dist/templates/base/src/styles/colors.scss +10 -10
  42. package/dist/templates/base/src/styles/custom.scss +2 -2
  43. package/dist/templates/base/tailwind.config.ts +7 -7
  44. package/dist/templates/base/tsconfig.json +16 -16
  45. package/dist/templates/base/vite.config.mts +5 -5
  46. package/dist/templates/mocks/sample-data/constants.ts +86 -86
  47. package/dist/templates/mocks/sample-data/index.ts +2 -2
  48. package/dist/templates/mocks/sample-data/methods.ts +65 -65
  49. package/dist/templates/modules/classic-module/composables/index.ts +2 -2
  50. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +19 -19
  51. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +23 -23
  52. package/dist/templates/modules/classic-module/index.ts +8 -8
  53. package/dist/templates/modules/classic-module/locales/en.json +28 -28
  54. package/dist/templates/modules/classic-module/locales/index.ts +2 -2
  55. package/dist/templates/modules/classic-module/pages/details.vue +61 -61
  56. package/dist/templates/modules/classic-module/pages/index.ts +2 -2
  57. package/dist/templates/modules/classic-module/pages/list.vue +162 -162
  58. package/dist/templates/modules/dynamic-module/composables/index.ts +2 -2
  59. package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +37 -37
  60. package/dist/templates/modules/dynamic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +49 -49
  61. package/dist/templates/modules/dynamic-module/index.ts +8 -8
  62. package/dist/templates/modules/dynamic-module/locales/en.json +35 -35
  63. package/dist/templates/modules/dynamic-module/locales/index.ts +2 -2
  64. package/dist/templates/modules/dynamic-module/pages/details.ts +20 -20
  65. package/dist/templates/modules/dynamic-module/pages/index.ts +4 -4
  66. package/dist/templates/modules/dynamic-module/pages/list.ts +35 -35
  67. package/dist/templates/sample/classic-module/composables/index.ts +2 -2
  68. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +41 -41
  69. package/dist/templates/sample/classic-module/composables/useList/index.ts +41 -41
  70. package/dist/templates/sample/classic-module/index.ts +8 -8
  71. package/dist/templates/sample/classic-module/locales/en.json +59 -59
  72. package/dist/templates/sample/classic-module/locales/index.ts +2 -2
  73. package/dist/templates/sample/classic-module/pages/details.vue +257 -257
  74. package/dist/templates/sample/classic-module/pages/index.ts +2 -2
  75. package/dist/templates/sample/dynamic-module/composables/index.ts +2 -2
  76. package/dist/templates/sample/dynamic-module/composables/useDetails/index.ts +46 -46
  77. package/dist/templates/sample/dynamic-module/composables/useList/index.ts +50 -50
  78. package/dist/templates/sample/dynamic-module/index.ts +8 -8
  79. package/dist/templates/sample/dynamic-module/locales/en.json +69 -69
  80. package/dist/templates/sample/dynamic-module/locales/index.ts +2 -2
  81. package/dist/templates/sample/dynamic-module/pages/details.ts +100 -100
  82. package/dist/templates/sample/dynamic-module/pages/index.ts +4 -4
  83. package/dist/templates/sample/dynamic-module/pages/list.ts +81 -81
  84. package/package.json +4 -3
@@ -1,257 +1,257 @@
1
- <template>
2
- <VcBlade
3
- v-loading="loading"
4
- :title="title"
5
- :expanded="expanded"
6
- :closable="closable"
7
- width="70%"
8
- :toolbar-items="bladeToolbar"
9
- @close="$emit('close:blade')"
10
- @expand="$emit('expand:blade')"
11
- @collapse="$emit('collapse:blade')"
12
- >
13
- <VcContainer class="tw-p-2">
14
- <VcForm>
15
- <Field
16
- v-slot="{ errorMessage, handleChange, errors }"
17
- name="name"
18
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.NAME')"
19
- rules="required"
20
- :model-value="item.name"
21
- >
22
- <VcInput
23
- v-model="item.name"
24
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.NAME')"
25
- required
26
- :error="!!errors.length"
27
- :error-message="errorMessage"
28
- class="tw-mb-4"
29
- @update:model-value="handleChange"
30
- ></VcInput>
31
- </Field>
32
- <VcCard
33
- header="Content"
34
- class="tw-mb-4"
35
- >
36
- <div class="tw-p-4">
37
- <Field
38
- v-slot="{ errorMessage, handleChange, errors }"
39
- name="guid"
40
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.GUID')"
41
- :rules="{
42
- required: true,
43
- regex: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/,
44
- }"
45
- :model-value="item.guid"
46
- >
47
- <VcInput
48
- v-model="item.guid"
49
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.GUID')"
50
- required
51
- :error="!!errors.length"
52
- :error-message="errorMessage"
53
- class="tw-mb-4"
54
- @update:model-value="handleChange"
55
- ></VcInput>
56
- </Field>
57
- <Field
58
- v-slot="{ errorMessage, handleChange, errors }"
59
- name="description"
60
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.DESCRIPTION')"
61
- :rules="{
62
- required: true,
63
- }"
64
- :model-value="item.description"
65
- >
66
- <VcTextarea
67
- v-model="item.description"
68
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.DESCRIPTION')"
69
- required
70
- :error="!!errors.length"
71
- :error-message="errorMessage"
72
- @update:model-value="handleChange"
73
- ></VcTextarea>
74
- </Field>
75
- </div>
76
- </VcCard>
77
- <VcCard
78
- v-if="item.currency"
79
- header="Prices"
80
- >
81
- <VcRow class="tw-p-4 tw-gap-4">
82
- <VcCol :size="2">
83
- <Field
84
- v-slot="{ errorMessage, handleChange, errors }"
85
- name="price"
86
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.PRICE')"
87
- :rules="{
88
- required: true,
89
- }"
90
- :model-value="item.price"
91
- >
92
- <VcInputCurrency
93
- v-model="item.price"
94
- v-model:option="item.currency"
95
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.PRICE')"
96
- required
97
- option-value="value"
98
- option-label="label"
99
- :error="!!errors.length"
100
- :error-message="errorMessage"
101
- :options="currencyOptions"
102
- @update:model-value="handleChange"
103
- ></VcInputCurrency>
104
- </Field>
105
- </VcCol>
106
- <VcCol :size="2">
107
- <Field
108
- v-slot="{ errorMessage, handleChange, errors }"
109
- name="salePrice"
110
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.SALE_PRICE')"
111
- :rules="{
112
- required: true,
113
- }"
114
- :model-value="item.salePrice"
115
- >
116
- <VcInputCurrency
117
- v-model="item.salePrice"
118
- v-model:option="item.currency"
119
- :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.SALE_PRICE')"
120
- required
121
- option-value="value"
122
- option-label="label"
123
- :error="!!errors.length"
124
- :error-message="errorMessage"
125
- :options="currencyOptions"
126
- @update:model-value="handleChange"
127
- ></VcInputCurrency>
128
- </Field>
129
- </VcCol>
130
- </VcRow>
131
- </VcCard>
132
- </VcForm>
133
- </VcContainer>
134
- </VcBlade>
135
- </template>
136
-
137
- <script lang="ts" setup>
138
- import { IBladeToolbar, IParentCallArgs, useBeforeUnload, useBladeNavigation, usePopup } from "@vc-shell/framework";
139
- import { useDetails } from "./../composables";
140
- import { computed, onMounted, ref, unref, watch } from "vue";
141
- import { Field, useForm, useIsFormDirty, useIsFormValid } from "vee-validate";
142
- import { useI18n } from "vue-i18n";
143
- import * as _ from "lodash-es";
144
- import { MockedItem } from "../sample-data";
145
-
146
- export interface Props {
147
- expanded?: boolean;
148
- closable?: boolean;
149
- param?: string;
150
- }
151
-
152
- export interface Emits {
153
- (event: "parent:call", args: IParentCallArgs): void;
154
- (event: "collapse:blade"): void;
155
- (event: "expand:blade"): void;
156
- (event: "close:blade"): void;
157
- }
158
-
159
- defineOptions({
160
- url: "/sample-details",
161
- name: "SampleDetails",
162
- });
163
-
164
- const props = withDefaults(defineProps<Props>(), {
165
- expanded: true,
166
- closable: true,
167
- param: undefined,
168
- });
169
-
170
- const emit = defineEmits<Emits>();
171
-
172
- const { loading, getItem, saveItem, removeItem, item, currencyOptions } = useDetails();
173
- const { showConfirmation } = usePopup();
174
- const { onBeforeClose } = useBladeNavigation();
175
- const { t } = useI18n({ useScope: "global" });
176
- useForm({
177
- validateOnMount: false,
178
- });
179
- useBeforeUnload(computed(() => !isDisabled.value && modified.value));
180
-
181
- const modified = ref(false);
182
- const isFormValid = useIsFormValid();
183
- const isDirty = useIsFormDirty();
184
- const isDisabled = computed(() => {
185
- return !isDirty.value || !isFormValid.value;
186
- });
187
- let itemCopy: MockedItem;
188
- const title = computed(() => {
189
- return props.param
190
- ? item.value?.name
191
- ? item.value?.name + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS")
192
- : t("SAMPLE_APP.PAGES.DETAILS.TITLE.LOADING")
193
- : "Test App" + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS");
194
- });
195
-
196
- watch(
197
- () => item.value,
198
- (state) => {
199
- if (itemCopy) {
200
- modified.value = !_.isEqual(itemCopy, state);
201
- }
202
- },
203
- { deep: true },
204
- );
205
-
206
- const bladeToolbar = ref<IBladeToolbar[]>([
207
- {
208
- id: "save",
209
- icon: "fas fa-save",
210
- title: "Save",
211
- async clickHandler() {
212
- await saveItem(item.value);
213
- itemCopy = _.cloneDeep(item.value);
214
- modified.value = false;
215
- emit("parent:call", {
216
- method: "reload",
217
- });
218
- emit("close:blade");
219
- },
220
- disabled: computed(() => !(modified.value && !isDisabled.value)),
221
- },
222
- {
223
- id: "delete",
224
- icon: "fas fa-trash",
225
- title: "Delete",
226
- async clickHandler() {
227
- if (await showConfirmation(computed(() => t(`SAMPLE_APP.PAGES.ALERTS.DELETE`)))) {
228
- if (props.param) {
229
- await removeItem({ id: props.param });
230
- emit("parent:call", {
231
- method: "reload",
232
- });
233
-
234
- emit("close:blade");
235
- }
236
- }
237
- },
238
- },
239
- ]);
240
-
241
- onMounted(async () => {
242
- if (props.param) {
243
- await getItem({ id: props.param });
244
- itemCopy = _.cloneDeep(item.value);
245
- }
246
- });
247
-
248
- onBeforeClose(async () => {
249
- if (!isDisabled.value && modified.value) {
250
- return await showConfirmation(unref(computed(() => t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION"))));
251
- }
252
- });
253
-
254
- defineExpose({
255
- title,
256
- });
257
- </script>
1
+ <template>
2
+ <VcBlade
3
+ v-loading="loading"
4
+ :title="title"
5
+ :expanded="expanded"
6
+ :closable="closable"
7
+ width="70%"
8
+ :toolbar-items="bladeToolbar"
9
+ @close="$emit('close:blade')"
10
+ @expand="$emit('expand:blade')"
11
+ @collapse="$emit('collapse:blade')"
12
+ >
13
+ <VcContainer class="tw-p-2">
14
+ <VcForm>
15
+ <Field
16
+ v-slot="{ errorMessage, handleChange, errors }"
17
+ name="name"
18
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.NAME')"
19
+ rules="required"
20
+ :model-value="item.name"
21
+ >
22
+ <VcInput
23
+ v-model="item.name"
24
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.NAME')"
25
+ required
26
+ :error="!!errors.length"
27
+ :error-message="errorMessage"
28
+ class="tw-mb-4"
29
+ @update:model-value="handleChange"
30
+ ></VcInput>
31
+ </Field>
32
+ <VcCard
33
+ header="Content"
34
+ class="tw-mb-4"
35
+ >
36
+ <div class="tw-p-4">
37
+ <Field
38
+ v-slot="{ errorMessage, handleChange, errors }"
39
+ name="guid"
40
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.GUID')"
41
+ :rules="{
42
+ required: true,
43
+ regex: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/,
44
+ }"
45
+ :model-value="item.guid"
46
+ >
47
+ <VcInput
48
+ v-model="item.guid"
49
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.GUID')"
50
+ required
51
+ :error="!!errors.length"
52
+ :error-message="errorMessage"
53
+ class="tw-mb-4"
54
+ @update:model-value="handleChange"
55
+ ></VcInput>
56
+ </Field>
57
+ <Field
58
+ v-slot="{ errorMessage, handleChange, errors }"
59
+ name="description"
60
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.DESCRIPTION')"
61
+ :rules="{
62
+ required: true,
63
+ }"
64
+ :model-value="item.description"
65
+ >
66
+ <VcTextarea
67
+ v-model="item.description"
68
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.DESCRIPTION')"
69
+ required
70
+ :error="!!errors.length"
71
+ :error-message="errorMessage"
72
+ @update:model-value="handleChange"
73
+ ></VcTextarea>
74
+ </Field>
75
+ </div>
76
+ </VcCard>
77
+ <VcCard
78
+ v-if="item.currency"
79
+ header="Prices"
80
+ >
81
+ <VcRow class="tw-p-4 tw-gap-4">
82
+ <VcCol :size="2">
83
+ <Field
84
+ v-slot="{ errorMessage, handleChange, errors }"
85
+ name="price"
86
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.PRICE')"
87
+ :rules="{
88
+ required: true,
89
+ }"
90
+ :model-value="item.price"
91
+ >
92
+ <VcInputCurrency
93
+ v-model="item.price"
94
+ v-model:option="item.currency"
95
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.PRICE')"
96
+ required
97
+ option-value="value"
98
+ option-label="label"
99
+ :error="!!errors.length"
100
+ :error-message="errorMessage"
101
+ :options="currencyOptions"
102
+ @update:model-value="handleChange"
103
+ ></VcInputCurrency>
104
+ </Field>
105
+ </VcCol>
106
+ <VcCol :size="2">
107
+ <Field
108
+ v-slot="{ errorMessage, handleChange, errors }"
109
+ name="salePrice"
110
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.SALE_PRICE')"
111
+ :rules="{
112
+ required: true,
113
+ }"
114
+ :model-value="item.salePrice"
115
+ >
116
+ <VcInputCurrency
117
+ v-model="item.salePrice"
118
+ v-model:option="item.currency"
119
+ :label="$t('SAMPLE_APP.PAGES.DETAILS.FIELDS.SALE_PRICE')"
120
+ required
121
+ option-value="value"
122
+ option-label="label"
123
+ :error="!!errors.length"
124
+ :error-message="errorMessage"
125
+ :options="currencyOptions"
126
+ @update:model-value="handleChange"
127
+ ></VcInputCurrency>
128
+ </Field>
129
+ </VcCol>
130
+ </VcRow>
131
+ </VcCard>
132
+ </VcForm>
133
+ </VcContainer>
134
+ </VcBlade>
135
+ </template>
136
+
137
+ <script lang="ts" setup>
138
+ import { IBladeToolbar, IParentCallArgs, useBeforeUnload, useBladeNavigation, usePopup } from "@vc-shell/framework";
139
+ import { useDetails } from "./../composables";
140
+ import { computed, onMounted, ref, unref, watch } from "vue";
141
+ import { Field, useForm, useIsFormDirty, useIsFormValid } from "vee-validate";
142
+ import { useI18n } from "vue-i18n";
143
+ import * as _ from "lodash-es";
144
+ import { MockedItem } from "../sample-data";
145
+
146
+ export interface Props {
147
+ expanded?: boolean;
148
+ closable?: boolean;
149
+ param?: string;
150
+ }
151
+
152
+ export interface Emits {
153
+ (event: "parent:call", args: IParentCallArgs): void;
154
+ (event: "collapse:blade"): void;
155
+ (event: "expand:blade"): void;
156
+ (event: "close:blade"): void;
157
+ }
158
+
159
+ defineOptions({
160
+ url: "/sample-details",
161
+ name: "SampleDetails",
162
+ });
163
+
164
+ const props = withDefaults(defineProps<Props>(), {
165
+ expanded: true,
166
+ closable: true,
167
+ param: undefined,
168
+ });
169
+
170
+ const emit = defineEmits<Emits>();
171
+
172
+ const { loading, getItem, saveItem, removeItem, item, currencyOptions } = useDetails();
173
+ const { showConfirmation } = usePopup();
174
+ const { onBeforeClose } = useBladeNavigation();
175
+ const { t } = useI18n({ useScope: "global" });
176
+ useForm({
177
+ validateOnMount: false,
178
+ });
179
+ useBeforeUnload(computed(() => !isDisabled.value && modified.value));
180
+
181
+ const modified = ref(false);
182
+ const isFormValid = useIsFormValid();
183
+ const isDirty = useIsFormDirty();
184
+ const isDisabled = computed(() => {
185
+ return !isDirty.value || !isFormValid.value;
186
+ });
187
+ let itemCopy: MockedItem;
188
+ const title = computed(() => {
189
+ return props.param
190
+ ? item.value?.name
191
+ ? item.value?.name + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS")
192
+ : t("SAMPLE_APP.PAGES.DETAILS.TITLE.LOADING")
193
+ : "Test App" + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS");
194
+ });
195
+
196
+ watch(
197
+ () => item.value,
198
+ (state) => {
199
+ if (itemCopy) {
200
+ modified.value = !_.isEqual(itemCopy, state);
201
+ }
202
+ },
203
+ { deep: true },
204
+ );
205
+
206
+ const bladeToolbar = ref<IBladeToolbar[]>([
207
+ {
208
+ id: "save",
209
+ icon: "fas fa-save",
210
+ title: "Save",
211
+ async clickHandler() {
212
+ await saveItem(item.value);
213
+ itemCopy = _.cloneDeep(item.value);
214
+ modified.value = false;
215
+ emit("parent:call", {
216
+ method: "reload",
217
+ });
218
+ emit("close:blade");
219
+ },
220
+ disabled: computed(() => !(modified.value && !isDisabled.value)),
221
+ },
222
+ {
223
+ id: "delete",
224
+ icon: "fas fa-trash",
225
+ title: "Delete",
226
+ async clickHandler() {
227
+ if (await showConfirmation(computed(() => t(`SAMPLE_APP.PAGES.ALERTS.DELETE`)))) {
228
+ if (props.param) {
229
+ await removeItem({ id: props.param });
230
+ emit("parent:call", {
231
+ method: "reload",
232
+ });
233
+
234
+ emit("close:blade");
235
+ }
236
+ }
237
+ },
238
+ },
239
+ ]);
240
+
241
+ onMounted(async () => {
242
+ if (props.param) {
243
+ await getItem({ id: props.param });
244
+ itemCopy = _.cloneDeep(item.value);
245
+ }
246
+ });
247
+
248
+ onBeforeClose(async () => {
249
+ if (!isDisabled.value && modified.value) {
250
+ return await showConfirmation(unref(computed(() => t("SAMPLE_APP.PAGES.ALERTS.CLOSE_CONFIRMATION"))));
251
+ }
252
+ });
253
+
254
+ defineExpose({
255
+ title,
256
+ });
257
+ </script>
@@ -1,2 +1,2 @@
1
- export { default as List } from "./list.vue";
2
- export {default as Details } from './details.vue'
1
+ export { default as List } from "./list.vue";
2
+ export {default as Details } from './details.vue'
@@ -1,2 +1,2 @@
1
- export { default as useList } from "./useList";
2
- export { default as useDetails } from "./useDetails";
1
+ export { default as useList } from "./useList";
2
+ export { default as useDetails } from "./useDetails";
@@ -1,46 +1,46 @@
1
- import { computed, ref, Ref } from "vue";
2
- import { DetailsBaseBladeScope, DetailsComposableArgs, UseDetails, useDetailsFactory } from "@vc-shell/framework";
3
- import { addNewMockItem, loadMockItem, removeMockItem, updateMockItem } from "../../sample-data/methods";
4
- import { currencyOptions, MockedItem } from "../../sample-data";
5
- import { useI18n } from "vue-i18n";
6
-
7
- export interface DynamicItemScope extends DetailsBaseBladeScope {
8
- currencyOptions: typeof currencyOptions;
9
- }
10
-
11
- export default (args: DetailsComposableArgs): UseDetails<MockedItem, DynamicItemScope> => {
12
- const factory = useDetailsFactory<MockedItem>({
13
- load: loadMockItem,
14
- saveChanges: (details) => {
15
- return details.id ? updateMockItem(details) : addNewMockItem(details);
16
- },
17
- remove: removeMockItem,
18
- });
19
-
20
- const { load, saveChanges, remove, loading, item, validationState } = factory();
21
-
22
- const scope: DynamicItemScope = {
23
- currencyOptions,
24
- };
25
-
26
- const { t } = useI18n({ useScope: "global" });
27
-
28
- const bladeTitle = computed(() => {
29
- return args.props.param
30
- ? item.value?.name
31
- ? item.value?.name + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS")
32
- : t("SAMPLE_APP.PAGES.DETAILS.TITLE.LOADING")
33
- : "Test App" + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS");
34
- });
35
-
36
- return {
37
- load,
38
- saveChanges,
39
- remove,
40
- loading,
41
- item,
42
- validationState,
43
- bladeTitle,
44
- scope,
45
- };
46
- };
1
+ import { computed, ref, Ref } from "vue";
2
+ import { DetailsBaseBladeScope, DetailsComposableArgs, UseDetails, useDetailsFactory } from "@vc-shell/framework";
3
+ import { addNewMockItem, loadMockItem, removeMockItem, updateMockItem } from "../../sample-data/methods";
4
+ import { currencyOptions, MockedItem } from "../../sample-data";
5
+ import { useI18n } from "vue-i18n";
6
+
7
+ export interface DynamicItemScope extends DetailsBaseBladeScope {
8
+ currencyOptions: typeof currencyOptions;
9
+ }
10
+
11
+ export default (args: DetailsComposableArgs): UseDetails<MockedItem, DynamicItemScope> => {
12
+ const factory = useDetailsFactory<MockedItem>({
13
+ load: loadMockItem,
14
+ saveChanges: (details) => {
15
+ return details.id ? updateMockItem(details) : addNewMockItem(details);
16
+ },
17
+ remove: removeMockItem,
18
+ });
19
+
20
+ const { load, saveChanges, remove, loading, item, validationState } = factory();
21
+
22
+ const scope: DynamicItemScope = {
23
+ currencyOptions,
24
+ };
25
+
26
+ const { t } = useI18n({ useScope: "global" });
27
+
28
+ const bladeTitle = computed(() => {
29
+ return args.props.param
30
+ ? item.value?.name
31
+ ? item.value?.name + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS")
32
+ : t("SAMPLE_APP.PAGES.DETAILS.TITLE.LOADING")
33
+ : "Test App" + t("SAMPLE_APP.PAGES.DETAILS.TITLE.DETAILS");
34
+ });
35
+
36
+ return {
37
+ load,
38
+ saveChanges,
39
+ remove,
40
+ loading,
41
+ item,
42
+ validationState,
43
+ bladeTitle,
44
+ scope,
45
+ };
46
+ };