@bagelink/vue 0.0.116 → 0.0.120
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/dist/components/DataPreview.vue.d.ts +5 -5
- package/dist/components/FormSchema.vue.d.ts +5 -5
- package/dist/components/FormSchema.vue.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.mjs +12 -12
- package/dist/style.css +3 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/DataPreview.vue +3 -3
- package/src/components/FormSchema.vue +6 -6
- package/src/components/LangText.vue +1 -1
- package/src/components/PersonPreview.vue +1 -1
- package/src/components/PersonPreviewFormkit.vue +1 -1
- package/src/utils/index.ts +2 -2
|
@@ -2,18 +2,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
2
2
|
data: Record<string, any>;
|
|
3
3
|
schema?: Record<string, any>[] | undefined;
|
|
4
4
|
title?: string | undefined;
|
|
5
|
-
|
|
5
|
+
i18nT: (str: string) => string;
|
|
6
6
|
}>, {
|
|
7
|
-
|
|
7
|
+
i18nT: (str: string) => string;
|
|
8
8
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
9
|
data: Record<string, any>;
|
|
10
10
|
schema?: Record<string, any>[] | undefined;
|
|
11
11
|
title?: string | undefined;
|
|
12
|
-
|
|
12
|
+
i18nT: (str: string) => string;
|
|
13
13
|
}>, {
|
|
14
|
-
|
|
14
|
+
i18nT: (str: string) => string;
|
|
15
15
|
}>>>, {
|
|
16
|
-
|
|
16
|
+
i18nT: (str: string) => string;
|
|
17
17
|
}, {}>, {
|
|
18
18
|
footer?(_: {}): any;
|
|
19
19
|
}>;
|
|
@@ -3,9 +3,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
3
3
|
modelValue?: any;
|
|
4
4
|
schema: FormKitSchemaDefinition;
|
|
5
5
|
onDelete?: ((id: string) => void) | undefined;
|
|
6
|
-
|
|
6
|
+
i18nT: (key: string) => string;
|
|
7
7
|
}>, {
|
|
8
|
-
|
|
8
|
+
i18nT: (key: string) => string;
|
|
9
9
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
10
|
submit: (...args: any[]) => void;
|
|
11
11
|
"update:modelValue": (...args: any[]) => void;
|
|
@@ -13,14 +13,14 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
13
13
|
modelValue?: any;
|
|
14
14
|
schema: FormKitSchemaDefinition;
|
|
15
15
|
onDelete?: ((id: string) => void) | undefined;
|
|
16
|
-
|
|
16
|
+
i18nT: (key: string) => string;
|
|
17
17
|
}>, {
|
|
18
|
-
|
|
18
|
+
i18nT: (key: string) => string;
|
|
19
19
|
}>>> & {
|
|
20
20
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
21
21
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
22
22
|
}, {
|
|
23
|
-
|
|
23
|
+
i18nT: (key: string) => string;
|
|
24
24
|
}, {}>;
|
|
25
25
|
export default _default;
|
|
26
26
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormSchema.vue.d.ts","sourceRoot":"","sources":["../../src/components/FormSchema.vue"],"names":[],"mappings":"AA0BA;AAGA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;;iBA4J/C,GAAG;YACR,uBAAuB;qBAEd,MAAM,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"FormSchema.vue.d.ts","sourceRoot":"","sources":["../../src/components/FormSchema.vue"],"names":[],"mappings":"AA0BA;AAGA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;;iBA4J/C,GAAG;YACR,uBAAuB;qBAEd,MAAM,KAAK,IAAI;iBAEnB,MAAM,KAAK,MAAM;;;;;;;iBALjB,GAAG;YACR,uBAAuB;qBAEd,MAAM,KAAK,IAAI;iBAEnB,MAAM,KAAK,MAAM;;;;;;;iBAAjB,MAAM,KAAK,MAAM;;AAP/B,wBAcG;AAGH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -2364,11 +2364,11 @@ const useFormkit = () => {
|
|
|
2364
2364
|
return formkit;
|
|
2365
2365
|
};
|
|
2366
2366
|
const initials = (...strArr) => strArr.map((str) => str == null ? void 0 : str.charAt(0)).join("");
|
|
2367
|
-
const parseLocale = (str,
|
|
2367
|
+
const parseLocale = (str, i18nT = (_str) => _str) => {
|
|
2368
2368
|
const [_, w] = str.split(/\$t\('?"?|'?"?\)/);
|
|
2369
2369
|
if (!w)
|
|
2370
2370
|
return str;
|
|
2371
|
-
return
|
|
2371
|
+
return i18nT(w);
|
|
2372
2372
|
};
|
|
2373
2373
|
const _hoisted_1$V = { ref: "el" };
|
|
2374
2374
|
const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -15217,7 +15217,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
|
15217
15217
|
data: {},
|
|
15218
15218
|
schema: {},
|
|
15219
15219
|
title: {},
|
|
15220
|
-
|
|
15220
|
+
i18nT: { type: Function, default: (str) => str }
|
|
15221
15221
|
},
|
|
15222
15222
|
setup(__props) {
|
|
15223
15223
|
const keysToIgnore = ["id", "person_id", "person", "created_at", "updated_at"];
|
|
@@ -15247,7 +15247,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
|
15247
15247
|
class: "data-row",
|
|
15248
15248
|
key
|
|
15249
15249
|
}, [
|
|
15250
|
-
vue.createElementVNode("div", _hoisted_5$i, vue.toDisplayString(_ctx
|
|
15250
|
+
vue.createElementVNode("div", _hoisted_5$i, vue.toDisplayString(_ctx.i18nT(vue.unref(keyToLabel)(key))), 1),
|
|
15251
15251
|
vue.createElementVNode("div", _hoisted_6$f, vue.toDisplayString(value), 1)
|
|
15252
15252
|
]);
|
|
15253
15253
|
}), 128))
|
|
@@ -15257,14 +15257,14 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
|
|
|
15257
15257
|
};
|
|
15258
15258
|
}
|
|
15259
15259
|
});
|
|
15260
|
-
const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-
|
|
15260
|
+
const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-d4ee3566"]]);
|
|
15261
15261
|
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
15262
15262
|
__name: "FormSchema",
|
|
15263
15263
|
props: {
|
|
15264
15264
|
modelValue: {},
|
|
15265
15265
|
schema: {},
|
|
15266
15266
|
onDelete: {},
|
|
15267
|
-
|
|
15267
|
+
i18nT: { type: Function, default: (key) => key }
|
|
15268
15268
|
},
|
|
15269
15269
|
emits: ["update:modelValue", "submit"],
|
|
15270
15270
|
setup(__props, { emit: __emit }) {
|
|
@@ -15275,13 +15275,13 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
|
15275
15275
|
const props2 = __props;
|
|
15276
15276
|
const data2 = vue.reactive({
|
|
15277
15277
|
...props2.modelValue,
|
|
15278
|
-
t: (val) => props2
|
|
15278
|
+
t: (val) => props2.i18nT(val)
|
|
15279
15279
|
});
|
|
15280
15280
|
const runDelete = () => {
|
|
15281
15281
|
showModal(
|
|
15282
15282
|
{
|
|
15283
15283
|
class: "small-modal",
|
|
15284
|
-
title: props2
|
|
15284
|
+
title: props2.i18nT("Are you sure?"),
|
|
15285
15285
|
actions: [
|
|
15286
15286
|
{
|
|
15287
15287
|
value: "Confirm",
|
|
@@ -15294,7 +15294,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
|
15294
15294
|
{ value: "Cancel", color: "gray" }
|
|
15295
15295
|
]
|
|
15296
15296
|
},
|
|
15297
|
-
{ default: props2
|
|
15297
|
+
{ default: props2.i18nT("form.deleteMessage") }
|
|
15298
15298
|
);
|
|
15299
15299
|
};
|
|
15300
15300
|
return (_ctx, _cache) => {
|
|
@@ -15307,7 +15307,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
|
15307
15307
|
modelValue: _ctx.modelValue,
|
|
15308
15308
|
"onUpdate:modelValue": handleEmit,
|
|
15309
15309
|
onSubmit: runSubmit,
|
|
15310
|
-
submitLabel: _ctx
|
|
15310
|
+
submitLabel: _ctx.i18nT("save")
|
|
15311
15311
|
}, {
|
|
15312
15312
|
default: vue.withCtx(() => [
|
|
15313
15313
|
vue.createVNode(_component_FormKitSchema, {
|
|
@@ -15564,7 +15564,7 @@ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
|
15564
15564
|
schema: props2.personSchema(),
|
|
15565
15565
|
modelValue: props2.person,
|
|
15566
15566
|
onSubmit: (newPerson) => bagel.put("/person", newPerson)
|
|
15567
|
-
// .then(() => toast.success(
|
|
15567
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))),
|
|
15568
15568
|
});
|
|
15569
15569
|
};
|
|
15570
15570
|
return (_ctx, _cache) => {
|
|
@@ -17914,7 +17914,7 @@ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
|
17914
17914
|
schema: props2.personSchema,
|
|
17915
17915
|
modelValue: person.value,
|
|
17916
17916
|
onSubmit: (newPerson) => bagel.put("/person", newPerson)
|
|
17917
|
-
// .then(() => toast.success(
|
|
17917
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))), // TODO: use toast
|
|
17918
17918
|
});
|
|
17919
17919
|
};
|
|
17920
17920
|
return (_ctx, _cache) => {
|
package/dist/index.mjs
CHANGED
|
@@ -2362,11 +2362,11 @@ const useFormkit = () => {
|
|
|
2362
2362
|
return formkit;
|
|
2363
2363
|
};
|
|
2364
2364
|
const initials = (...strArr) => strArr.map((str) => str == null ? void 0 : str.charAt(0)).join("");
|
|
2365
|
-
const parseLocale = (str,
|
|
2365
|
+
const parseLocale = (str, i18nT = (_str) => _str) => {
|
|
2366
2366
|
const [_, w] = str.split(/\$t\('?"?|'?"?\)/);
|
|
2367
2367
|
if (!w)
|
|
2368
2368
|
return str;
|
|
2369
|
-
return
|
|
2369
|
+
return i18nT(w);
|
|
2370
2370
|
};
|
|
2371
2371
|
const _hoisted_1$V = { ref: "el" };
|
|
2372
2372
|
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
@@ -15215,7 +15215,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
15215
15215
|
data: {},
|
|
15216
15216
|
schema: {},
|
|
15217
15217
|
title: {},
|
|
15218
|
-
|
|
15218
|
+
i18nT: { type: Function, default: (str) => str }
|
|
15219
15219
|
},
|
|
15220
15220
|
setup(__props) {
|
|
15221
15221
|
const keysToIgnore = ["id", "person_id", "person", "created_at", "updated_at"];
|
|
@@ -15245,7 +15245,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
15245
15245
|
class: "data-row",
|
|
15246
15246
|
key
|
|
15247
15247
|
}, [
|
|
15248
|
-
createElementVNode("div", _hoisted_5$i, toDisplayString(_ctx
|
|
15248
|
+
createElementVNode("div", _hoisted_5$i, toDisplayString(_ctx.i18nT(unref(keyToLabel)(key))), 1),
|
|
15249
15249
|
createElementVNode("div", _hoisted_6$f, toDisplayString(value), 1)
|
|
15250
15250
|
]);
|
|
15251
15251
|
}), 128))
|
|
@@ -15255,14 +15255,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
15255
15255
|
};
|
|
15256
15256
|
}
|
|
15257
15257
|
});
|
|
15258
|
-
const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-
|
|
15258
|
+
const DataPreview = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-d4ee3566"]]);
|
|
15259
15259
|
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
15260
15260
|
__name: "FormSchema",
|
|
15261
15261
|
props: {
|
|
15262
15262
|
modelValue: {},
|
|
15263
15263
|
schema: {},
|
|
15264
15264
|
onDelete: {},
|
|
15265
|
-
|
|
15265
|
+
i18nT: { type: Function, default: (key) => key }
|
|
15266
15266
|
},
|
|
15267
15267
|
emits: ["update:modelValue", "submit"],
|
|
15268
15268
|
setup(__props, { emit: __emit }) {
|
|
@@ -15273,13 +15273,13 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
15273
15273
|
const props2 = __props;
|
|
15274
15274
|
const data2 = reactive({
|
|
15275
15275
|
...props2.modelValue,
|
|
15276
|
-
t: (val) => props2
|
|
15276
|
+
t: (val) => props2.i18nT(val)
|
|
15277
15277
|
});
|
|
15278
15278
|
const runDelete = () => {
|
|
15279
15279
|
showModal(
|
|
15280
15280
|
{
|
|
15281
15281
|
class: "small-modal",
|
|
15282
|
-
title: props2
|
|
15282
|
+
title: props2.i18nT("Are you sure?"),
|
|
15283
15283
|
actions: [
|
|
15284
15284
|
{
|
|
15285
15285
|
value: "Confirm",
|
|
@@ -15292,7 +15292,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
15292
15292
|
{ value: "Cancel", color: "gray" }
|
|
15293
15293
|
]
|
|
15294
15294
|
},
|
|
15295
|
-
{ default: props2
|
|
15295
|
+
{ default: props2.i18nT("form.deleteMessage") }
|
|
15296
15296
|
);
|
|
15297
15297
|
};
|
|
15298
15298
|
return (_ctx, _cache) => {
|
|
@@ -15305,7 +15305,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
15305
15305
|
modelValue: _ctx.modelValue,
|
|
15306
15306
|
"onUpdate:modelValue": handleEmit,
|
|
15307
15307
|
onSubmit: runSubmit,
|
|
15308
|
-
submitLabel: _ctx
|
|
15308
|
+
submitLabel: _ctx.i18nT("save")
|
|
15309
15309
|
}, {
|
|
15310
15310
|
default: withCtx(() => [
|
|
15311
15311
|
createVNode(_component_FormKitSchema, {
|
|
@@ -15562,7 +15562,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
15562
15562
|
schema: props2.personSchema(),
|
|
15563
15563
|
modelValue: props2.person,
|
|
15564
15564
|
onSubmit: (newPerson) => bagel.put("/person", newPerson)
|
|
15565
|
-
// .then(() => toast.success(
|
|
15565
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))),
|
|
15566
15566
|
});
|
|
15567
15567
|
};
|
|
15568
15568
|
return (_ctx, _cache) => {
|
|
@@ -17912,7 +17912,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
17912
17912
|
schema: props2.personSchema,
|
|
17913
17913
|
modelValue: person.value,
|
|
17914
17914
|
onSubmit: (newPerson) => bagel.put("/person", newPerson)
|
|
17915
|
-
// .then(() => toast.success(
|
|
17915
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))), // TODO: use toast
|
|
17916
17916
|
});
|
|
17917
17917
|
};
|
|
17918
17918
|
return (_ctx, _cache) => {
|
package/dist/style.css
CHANGED
|
@@ -757,12 +757,12 @@
|
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
.data[data-v-
|
|
760
|
+
.data[data-v-d4ee3566] {
|
|
761
761
|
border: 1.1px solid var(--border-color);
|
|
762
762
|
padding: 20px;
|
|
763
763
|
border-radius: var(--input-border-radius);
|
|
764
764
|
}
|
|
765
|
-
.data-row[data-v-
|
|
765
|
+
.data-row[data-v-d4ee3566] {
|
|
766
766
|
display: flex;
|
|
767
767
|
justify-content: space-between;
|
|
768
768
|
padding-bottom: 0.5rem;
|
|
@@ -770,7 +770,7 @@
|
|
|
770
770
|
opacity: 0.8;
|
|
771
771
|
border-bottom: 1px solid var(--border-color);
|
|
772
772
|
}
|
|
773
|
-
.data-link[data-v-
|
|
773
|
+
.data-link[data-v-d4ee3566] {
|
|
774
774
|
display: block;
|
|
775
775
|
font-size: var(--input-font-size);
|
|
776
776
|
margin-bottom: 2px;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare function computeFields(modelValue: Record<string, any>): BagelFie
|
|
|
5
5
|
export declare const copyText: (text: string, cb?: ((msg: string) => void) | undefined) => Promise<void>;
|
|
6
6
|
export declare const useFormkit: () => unknown;
|
|
7
7
|
export declare const initials: (...strArr: string[]) => string;
|
|
8
|
-
export declare const parseLocale: (str: string,
|
|
8
|
+
export declare const parseLocale: (str: string, i18nT?: (_str: string) => string) => string;
|
|
9
9
|
export { formatString } from './strings';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,eAAO,MAAM,QAAQ,OAAQ,MAAM,IAAI,yBAGtC,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,WAG3B,CAAC;AAEZ,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,UAAU,EAAE,CAmB3E;AAED,eAAO,MAAM,QAAQ,SACd,MAAM,cAED,MAAM,KAAK,IAAI,+BAI1B,CAAC;AAEF,eAAO,MAAM,UAAU,eAGtB,CAAC;AAEF,eAAO,MAAM,QAAQ,cAAe,MAAM,EAAE,WAAiD,CAAC;AAE9F,eAAO,MAAM,WAAW,QAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,eAAO,MAAM,QAAQ,OAAQ,MAAM,IAAI,yBAGtC,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,WAG3B,CAAC;AAEZ,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,UAAU,EAAE,CAmB3E;AAED,eAAO,MAAM,QAAQ,SACd,MAAM,cAED,MAAM,KAAK,IAAI,+BAI1B,CAAC;AAEF,eAAO,MAAM,UAAU,eAGtB,CAAC;AAEF,eAAO,MAAM,QAAQ,cAAe,MAAM,EAAE,WAAiD,CAAC;AAE9F,eAAO,MAAM,WAAW,QAAS,MAAM,iBAAiB,MAAM,sBAK7D,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
:key="key"
|
|
34
34
|
>
|
|
35
35
|
<div class="key">
|
|
36
|
-
{{
|
|
36
|
+
{{ i18nT(keyToLabel(key)) }}
|
|
37
37
|
</div>
|
|
38
38
|
<div class="vlue">
|
|
39
39
|
{{ value }}
|
|
@@ -54,9 +54,9 @@ withDefaults(defineProps<{
|
|
|
54
54
|
data: Record<string, any>,
|
|
55
55
|
schema?: Record<string, any>[],
|
|
56
56
|
title?: string,
|
|
57
|
-
|
|
57
|
+
i18nT: (str: string) => string,
|
|
58
58
|
}>(), {
|
|
59
|
-
|
|
59
|
+
i18nT: (str: string) => str,
|
|
60
60
|
});
|
|
61
61
|
</script>
|
|
62
62
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:modelValue="modelValue"
|
|
6
6
|
@update:modelValue="handleEmit"
|
|
7
7
|
@submit="runSubmit"
|
|
8
|
-
:submitLabel="
|
|
8
|
+
:submitLabel="i18nT('save')"
|
|
9
9
|
>
|
|
10
10
|
<FormKitSchema
|
|
11
11
|
:schema="schema"
|
|
@@ -43,21 +43,21 @@ const props = withDefaults(defineProps<{
|
|
|
43
43
|
// eslint-disable-next-line no-unused-vars
|
|
44
44
|
onDelete?: ((id: string) => void);
|
|
45
45
|
// eslint-disable-next-line no-unused-vars
|
|
46
|
-
|
|
46
|
+
i18nT: (key: string) => string;
|
|
47
47
|
}>(), {
|
|
48
|
-
|
|
48
|
+
i18nT: (key: string) => key,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
const data = reactive({
|
|
52
52
|
...props.modelValue,
|
|
53
|
-
t: (val: string) => props
|
|
53
|
+
t: (val: string) => props.i18nT(val),
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
const runDelete = () => {
|
|
57
57
|
showModal(
|
|
58
58
|
{
|
|
59
59
|
class: 'small-modal',
|
|
60
|
-
title: props
|
|
60
|
+
title: props.i18nT('Are you sure?'),
|
|
61
61
|
actions: [
|
|
62
62
|
{
|
|
63
63
|
value: 'Confirm',
|
|
@@ -67,7 +67,7 @@ const runDelete = () => {
|
|
|
67
67
|
{ value: 'Cancel', color: 'gray' },
|
|
68
68
|
],
|
|
69
69
|
},
|
|
70
|
-
{ default: props
|
|
70
|
+
{ default: props.i18nT('form.deleteMessage') },
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
73
|
</script>
|
|
@@ -100,7 +100,7 @@ const showEditForm = async () => {
|
|
|
100
100
|
modelValue: props.person,
|
|
101
101
|
onSubmit: (newPerson) => bagel
|
|
102
102
|
.put('/person', newPerson),
|
|
103
|
-
// .then(() => toast.success(
|
|
103
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))),
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
106
|
</script>
|
|
@@ -102,7 +102,7 @@ const showEditForm = async () => {
|
|
|
102
102
|
schema: props.personSchema,
|
|
103
103
|
modelValue: person,
|
|
104
104
|
onSubmit: (newPerson) => bagel.put('/person', newPerson),
|
|
105
|
-
// .then(() => toast.success(
|
|
105
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))), // TODO: use toast
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
108
|
</script>
|
package/src/utils/index.ts
CHANGED
|
@@ -50,11 +50,11 @@ export const useFormkit = () => {
|
|
|
50
50
|
|
|
51
51
|
export const initials = (...strArr: string[]) => strArr.map((str) => str?.charAt(0)).join('');
|
|
52
52
|
|
|
53
|
-
export const parseLocale = (str: string,
|
|
53
|
+
export const parseLocale = (str: string, i18nT = (_str: string) => _str) => {
|
|
54
54
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
55
55
|
const [_, w] = str.split(/\$t\('?"?|'?"?\)/);
|
|
56
56
|
if (!w) return str;
|
|
57
|
-
return
|
|
57
|
+
return i18nT(w);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
export { formatString } from './strings';
|