diff --git a/packages/vue/vue-vanilla/src/complex/OneOfControlRenderer.vue b/packages/vue/vue-vanilla/src/complex/OneOfControlRenderer.vue new file mode 100644 index 000000000..c8c93547b --- /dev/null +++ b/packages/vue/vue-vanilla/src/complex/OneOfControlRenderer.vue @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + {{ t('form.clear.title', 'Clear form?') }} + + + + {{ + t( + 'form.clear.text', + 'Your data will be cleared. Do you want to proceed?' + ) + }} + + + + + {{ t('form.clear.cancel', 'No') }} + + + {{ t('form.clear.confirm', 'Yes') }} + + + + + + + + \ No newline at end of file diff --git a/packages/vue/vue-vanilla/src/complex/components/CombinatorProperties.vue b/packages/vue/vue-vanilla/src/complex/components/CombinatorProperties.vue new file mode 100644 index 000000000..744b0a5fb --- /dev/null +++ b/packages/vue/vue-vanilla/src/complex/components/CombinatorProperties.vue @@ -0,0 +1,67 @@ + + + + + + + diff --git a/packages/vue/vue-vanilla/src/complex/index.ts b/packages/vue/vue-vanilla/src/complex/index.ts index 499a1b120..4feb4b1cf 100644 --- a/packages/vue/vue-vanilla/src/complex/index.ts +++ b/packages/vue/vue-vanilla/src/complex/index.ts @@ -1,5 +1,10 @@ export { default as ObjectControlRenderer } from './ObjectControlRenderer.vue'; +export { default as OneOfControlRenderer } from './OneOfControlRenderer.vue'; import { entry as objectControlRendererEntry } from './ObjectControlRenderer.vue'; +import { entry as oneOfControlRendererEntry } from './OneOfControlRenderer.vue'; -export const complexRenderers = [objectControlRendererEntry]; +export const complexRenderers = [ + objectControlRendererEntry, + oneOfControlRendererEntry, +]; diff --git a/packages/vue/vue-vanilla/src/styles/defaultStyles.ts b/packages/vue/vue-vanilla/src/styles/defaultStyles.ts index f7515d2e3..7a871c0d9 100644 --- a/packages/vue/vue-vanilla/src/styles/defaultStyles.ts +++ b/packages/vue/vue-vanilla/src/styles/defaultStyles.ts @@ -44,4 +44,12 @@ export const defaultStyles: Styles = { label: { root: 'label-element', }, + dialog: { + root: 'dialog-root', + title: 'dialog-title', + body: 'dialog-body', + actions: 'dialog-actions', + buttonPrimary: 'dialog-button-primary', + buttonSecondary: 'dialog-button-secondary', + }, }; diff --git a/packages/vue/vue-vanilla/src/styles/styles.ts b/packages/vue/vue-vanilla/src/styles/styles.ts index 292f43d21..06d155360 100644 --- a/packages/vue/vue-vanilla/src/styles/styles.ts +++ b/packages/vue/vue-vanilla/src/styles/styles.ts @@ -10,6 +10,7 @@ const createEmptyStyles = (): Styles => ({ group: {}, arrayList: {}, label: {}, + dialog: {}, }); export interface Styles { @@ -24,6 +25,14 @@ export interface Styles { select?: string; option?: string; }; + dialog: { + root?: string; + title?: string; + body?: string; + actions?: string; + buttonPrimary?: string; + buttonSecondary?: string; + }; verticalLayout: { root?: string; item?: string; diff --git a/packages/vue/vue-vanilla/src/util/composition.ts b/packages/vue/vue-vanilla/src/util/composition.ts index fc574ecba..cddaf0f8d 100644 --- a/packages/vue/vue-vanilla/src/util/composition.ts +++ b/packages/vue/vue-vanilla/src/util/composition.ts @@ -6,6 +6,7 @@ import { composePaths, findUISchema, getFirstPrimitiveProp, + JsonFormsSubStates, Resolve, } from '@jsonforms/core'; @@ -47,6 +48,29 @@ export const useVanillaControl = < }; }; +export const useTranslator = () => { + const jsonforms = inject('jsonforms'); + + if (!jsonforms) { + throw new Error( + "'jsonforms couldn't be injected. Are you within JSON Forms?" + ); + } + + if (!jsonforms.i18n || !jsonforms.i18n.translate) { + throw new Error( + "'jsonforms i18n couldn't be injected. Are you within JSON Forms?" + ); + } + + const translate = computed(() => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return jsonforms.i18n!.translate!; + }); + + return translate; +}; + /** * Adds styles and appliedOptions */
+ {{ + t( + 'form.clear.text', + 'Your data will be cleared. Do you want to proceed?' + ) + }} +