@tmagic/form 1.7.5 → 1.7.6
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/tmagic-form.js +14 -6
- package/dist/tmagic-form.umd.cjs +14 -5
- package/package.json +4 -4
- package/src/containers/Container.vue +2 -6
- package/src/utils/form.ts +15 -0
- package/types/index.d.ts +2 -1
package/dist/tmagic-form.js
CHANGED
|
@@ -235,6 +235,18 @@ const sortChange = (data, { prop, order }) => {
|
|
|
235
235
|
data.sort((a, b) => b[prop] - a[prop]);
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
|
+
const createObjectProp = (prop, key, name) => {
|
|
239
|
+
if (prop === "") {
|
|
240
|
+
return key;
|
|
241
|
+
}
|
|
242
|
+
const itemPath = `${prop}`.split(".");
|
|
243
|
+
if (name) {
|
|
244
|
+
if (`${itemPath[itemPath.length - 1]}` === `${name}`) {
|
|
245
|
+
return `${[...itemPath.slice(0, -1), key].join(".")}`;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return `${[...itemPath, key].join(".")}`;
|
|
249
|
+
};
|
|
238
250
|
|
|
239
251
|
const _hoisted_1$e = {
|
|
240
252
|
key: 0,
|
|
@@ -473,11 +485,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
473
485
|
value = filterHandler(filter, v);
|
|
474
486
|
if (typeof onChange === "function") {
|
|
475
487
|
const setModel = (key2, value2) => {
|
|
476
|
-
|
|
477
|
-
newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
|
|
478
|
-
} else {
|
|
479
|
-
newChangeRecords.push({ propPath: itemProp.value, value: value2 });
|
|
480
|
-
}
|
|
488
|
+
newChangeRecords.push({ propPath: createObjectProp(itemProp.value, key2, props.config.name), value: value2 });
|
|
481
489
|
};
|
|
482
490
|
const setFormValue = (key2, value2) => {
|
|
483
491
|
newChangeRecords.push({ propPath: key2, value: value2 });
|
|
@@ -5890,4 +5898,4 @@ const index = {
|
|
|
5890
5898
|
}
|
|
5891
5899
|
};
|
|
5892
5900
|
|
|
5893
|
-
export { _sfc_main$q as MCascader, _sfc_main$p as MCheckbox, _sfc_main$o as MCheckboxGroup, _sfc_main$n as MColorPicker, _sfc_main$A as MContainer, _sfc_main$m as MDate, _sfc_main$k as MDateTime, _sfc_main$l as MDaterange, _sfc_main$j as MDisplay, _sfc_main$i as MDynamicField, _sfc_main$z as MFieldset, _sfc_main$y as MFlexLayout, _sfc_main$g as MForm, _sfc_main as MFormBox, _sfc_main$f as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$h as MHidden, _sfc_main$e as MLink, _sfc_main$d as MNumber, _sfc_main$c as MNumberRange, _sfc_main$v as MPanel, _sfc_main$b as MRadioGroup, _sfc_main$t as MRow, _sfc_main$a as MSelect, _sfc_main$9 as MSwitch, _sfc_main$2 as MTable, _sfc_main$r as MTabs, _sfc_main$8 as MText, _sfc_main$7 as MTextarea, _sfc_main$6 as MTime, _sfc_main$5 as MTimerange, createForm, createValues, datetimeFormatter, index as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };
|
|
5901
|
+
export { _sfc_main$q as MCascader, _sfc_main$p as MCheckbox, _sfc_main$o as MCheckboxGroup, _sfc_main$n as MColorPicker, _sfc_main$A as MContainer, _sfc_main$m as MDate, _sfc_main$k as MDateTime, _sfc_main$l as MDaterange, _sfc_main$j as MDisplay, _sfc_main$i as MDynamicField, _sfc_main$z as MFieldset, _sfc_main$y as MFlexLayout, _sfc_main$g as MForm, _sfc_main as MFormBox, _sfc_main$f as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$h as MHidden, _sfc_main$e as MLink, _sfc_main$d as MNumber, _sfc_main$c as MNumberRange, _sfc_main$v as MPanel, _sfc_main$b as MRadioGroup, _sfc_main$t as MRow, _sfc_main$a as MSelect, _sfc_main$9 as MSwitch, _sfc_main$2 as MTable, _sfc_main$r as MTabs, _sfc_main$8 as MText, _sfc_main$7 as MTextarea, _sfc_main$6 as MTime, _sfc_main$5 as MTimerange, createForm, createObjectProp, createValues, datetimeFormatter, index as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };
|
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -3165,6 +3165,18 @@
|
|
|
3165
3165
|
data.sort((a, b) => b[prop] - a[prop]);
|
|
3166
3166
|
}
|
|
3167
3167
|
};
|
|
3168
|
+
const createObjectProp = (prop, key, name) => {
|
|
3169
|
+
if (prop === "") {
|
|
3170
|
+
return key;
|
|
3171
|
+
}
|
|
3172
|
+
const itemPath = `${prop}`.split(".");
|
|
3173
|
+
if (name) {
|
|
3174
|
+
if (`${itemPath[itemPath.length - 1]}` === `${name}`) {
|
|
3175
|
+
return `${[...itemPath.slice(0, -1), key].join(".")}`;
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
return `${[...itemPath, key].join(".")}`;
|
|
3179
|
+
};
|
|
3168
3180
|
|
|
3169
3181
|
const _hoisted_1$e = {
|
|
3170
3182
|
key: 0,
|
|
@@ -3403,11 +3415,7 @@
|
|
|
3403
3415
|
value = filterHandler(filter, v);
|
|
3404
3416
|
if (typeof onChange === "function") {
|
|
3405
3417
|
const setModel = (key2, value2) => {
|
|
3406
|
-
|
|
3407
|
-
newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
|
|
3408
|
-
} else {
|
|
3409
|
-
newChangeRecords.push({ propPath: itemProp.value, value: value2 });
|
|
3410
|
-
}
|
|
3418
|
+
newChangeRecords.push({ propPath: createObjectProp(itemProp.value, key2, props.config.name), value: value2 });
|
|
3411
3419
|
};
|
|
3412
3420
|
const setFormValue = (key2, value2) => {
|
|
3413
3421
|
newChangeRecords.push({ propPath: key2, value: value2 });
|
|
@@ -8853,6 +8861,7 @@
|
|
|
8853
8861
|
exports.MTime = _sfc_main$6;
|
|
8854
8862
|
exports.MTimerange = _sfc_main$5;
|
|
8855
8863
|
exports.createForm = createForm;
|
|
8864
|
+
exports.createObjectProp = createObjectProp;
|
|
8856
8865
|
exports.createValues = createValues;
|
|
8857
8866
|
exports.datetimeFormatter = datetimeFormatter;
|
|
8858
8867
|
exports.default = index;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.
|
|
2
|
+
"version": "1.7.6",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"vue": "^3.5.24",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
|
-
"@tmagic/
|
|
55
|
-
"@tmagic/form-schema": "1.7.
|
|
56
|
-
"@tmagic/
|
|
54
|
+
"@tmagic/utils": "1.7.6",
|
|
55
|
+
"@tmagic/form-schema": "1.7.6",
|
|
56
|
+
"@tmagic/design": "1.7.6"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"typescript": {
|
|
@@ -180,7 +180,7 @@ import type {
|
|
|
180
180
|
FormValue,
|
|
181
181
|
ToolTipConfigType,
|
|
182
182
|
} from '../schema';
|
|
183
|
-
import { display as displayFunction, filterFunction, getRules } from '../utils/form';
|
|
183
|
+
import { createObjectProp, display as displayFunction, filterFunction, getRules } from '../utils/form';
|
|
184
184
|
|
|
185
185
|
import FormLabel from './FormLabel.vue';
|
|
186
186
|
|
|
@@ -416,11 +416,7 @@ const onChangeHandler = async function (v: any, eventData: ContainerChangeEventD
|
|
|
416
416
|
|
|
417
417
|
if (typeof onChange === 'function') {
|
|
418
418
|
const setModel = (key: string, value: any) => {
|
|
419
|
-
|
|
420
|
-
newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key), value });
|
|
421
|
-
} else {
|
|
422
|
-
newChangeRecords.push({ propPath: itemProp.value, value });
|
|
423
|
-
}
|
|
419
|
+
newChangeRecords.push({ propPath: createObjectProp(itemProp.value, key, props.config.name), value });
|
|
424
420
|
};
|
|
425
421
|
|
|
426
422
|
const setFormValue = (key: string, value: any) => {
|
package/src/utils/form.ts
CHANGED
|
@@ -366,3 +366,18 @@ export const sortChange = (data: any[], { prop, order }: SortProp) => {
|
|
|
366
366
|
data.sort((a: any, b: any) => b[prop] - a[prop]);
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
|
+
|
|
370
|
+
export const createObjectProp = (prop: string, key: string, name?: string | number) => {
|
|
371
|
+
if (prop === '') {
|
|
372
|
+
return key;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const itemPath = `${prop}`.split('.');
|
|
376
|
+
|
|
377
|
+
if (name) {
|
|
378
|
+
if (`${itemPath[itemPath.length - 1]}` === `${name}`) {
|
|
379
|
+
return `${[...itemPath.slice(0, -1), key].join('.')}`;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return `${[...itemPath, key].join('.')}`;
|
|
383
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare const datetimeFormatter: (v: string | Date, defaultValue?: string, forma
|
|
|
31
31
|
declare const getDataByPage: (data: any[] | undefined, pagecontext: number, pagesize: number) => any[];
|
|
32
32
|
declare const sortArray: (data: any[], newIndex: number, oldIndex: number, sortKey?: string) => any[];
|
|
33
33
|
declare const sortChange: (data: any[], { prop, order }: SortProp) => void;
|
|
34
|
+
declare const createObjectProp: (prop: string, key: string, name?: string | number) => string;
|
|
34
35
|
|
|
35
36
|
declare const useAddField: (prop?: string) => void;
|
|
36
37
|
|
|
@@ -1330,5 +1331,5 @@ declare const _default: {
|
|
|
1330
1331
|
install(app: App, opt?: FormInstallOptions): void;
|
|
1331
1332
|
};
|
|
1332
1333
|
|
|
1333
|
-
export { _default$2 as MCascader, _default$c as MCheckbox, _default$7 as MCheckboxGroup, _default$8 as MColorPicker, _default$s as MContainer, _default$f as MDate, _default$e as MDateTime, _default$a as MDaterange, _default$5 as MDisplay, _default$1 as MDynamicField, _default$r as MFieldset, _default$q as MFlexLayout, _default$w as MForm, _default$t as MFormBox, _default$v as MFormDialog, _default$u as MFormDrawer, _default$l as MGroupList, _default$g as MHidden, _default$4 as MLink, _default$j as MNumber, _default$i as MNumberRange, _default$p as MPanel, _default$6 as MRadioGroup, _default$o as MRow, _default$3 as MSelect, _default$b as MSwitch, _default$m as MTable, _default$n as MTabs, _default$k as MText, _default$h as MTextarea, _default$d as MTime, _default$9 as MTimerange, createForm, createValues, datetimeFormatter, _default as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };
|
|
1334
|
+
export { _default$2 as MCascader, _default$c as MCheckbox, _default$7 as MCheckboxGroup, _default$8 as MColorPicker, _default$s as MContainer, _default$f as MDate, _default$e as MDateTime, _default$a as MDaterange, _default$5 as MDisplay, _default$1 as MDynamicField, _default$r as MFieldset, _default$q as MFlexLayout, _default$w as MForm, _default$t as MFormBox, _default$v as MFormDialog, _default$u as MFormDrawer, _default$l as MGroupList, _default$g as MHidden, _default$4 as MLink, _default$j as MNumber, _default$i as MNumberRange, _default$p as MPanel, _default$6 as MRadioGroup, _default$o as MRow, _default$3 as MSelect, _default$b as MSwitch, _default$m as MTable, _default$n as MTabs, _default$k as MText, _default$h as MTextarea, _default$d as MTime, _default$9 as MTimerange, createForm, createObjectProp, createValues, datetimeFormatter, _default as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };
|
|
1334
1335
|
export type { ChangeRecord, ContainerChangeEventData, FormInstallOptions, ValidateError };
|