x-prop-tree 0.8.30 → 0.8.32
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.
|
@@ -4,6 +4,7 @@ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
|
|
|
4
4
|
var en_exports = /* @__PURE__ */ __exportAll({ default: () => en_default });
|
|
5
5
|
var en_default = { "x-prop-tree": {
|
|
6
6
|
copy: "Copy",
|
|
7
|
+
json: "JSON",
|
|
7
8
|
jsonEditor: "JSON Editor",
|
|
8
9
|
noAdaptSlot: "No Adapt Slot",
|
|
9
10
|
noComp: "No Comp",
|
|
@@ -4,6 +4,7 @@ import { t as __exportAll } from "./rolldown-runtime.c6i0pdwe.js";
|
|
|
4
4
|
var zhHans_exports = /* @__PURE__ */ __exportAll({ default: () => zhHans_default });
|
|
5
5
|
var zhHans_default = { "x-prop-tree": {
|
|
6
6
|
copy: "拷贝",
|
|
7
|
+
json: "JSON",
|
|
7
8
|
jsonEditor: "JSON编辑器",
|
|
8
9
|
noAdaptSlot: "没有适配插槽",
|
|
9
10
|
noComp: "没有组件",
|
|
@@ -12,7 +13,8 @@ var zhHans_default = { "x-prop-tree": {
|
|
|
12
13
|
reset: "重置",
|
|
13
14
|
selectAdaptSlot: "选择适配插槽",
|
|
14
15
|
selectComp: "选择组件",
|
|
15
|
-
selectSlot: "选择插槽"
|
|
16
|
+
selectSlot: "选择插槽",
|
|
17
|
+
structuredData: "结构化数据"
|
|
16
18
|
} };
|
|
17
19
|
|
|
18
20
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//#region src/i18n/index.d.ts
|
|
2
|
-
declare function loadLocaleMessagePropTree(locale: string): Promise<{
|
|
2
|
+
export declare function loadLocaleMessagePropTree(locale: string): Promise<{
|
|
3
3
|
'x-prop-tree': {
|
|
4
4
|
copy: string;
|
|
5
|
+
json: string;
|
|
5
6
|
jsonEditor: string;
|
|
6
7
|
noAdaptSlot: string;
|
|
7
8
|
noComp: string;
|
|
@@ -19,4 +20,4 @@ declare const _default: {
|
|
|
19
20
|
install: (app: import("vue").App) => void;
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
22
|
-
export { _default as default
|
|
23
|
+
export { _default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){try{document.getElementById(`x-prop-tree`)?.remove();const e = document.createElement(`style`);e.setAttribute(`id`, `x-prop-tree`);const t = document.createTextNode(``);e.appendChild(t);document.head.appendChild(e);}catch(e){console.error('rolldown-plugin-inject-css', e);}})()
|
|
2
|
-
import { n as isEqual, r as cloneDeep, t as omit } from "./vendor.
|
|
2
|
+
import { n as isEqual, r as cloneDeep, t as omit } from "./vendor.mu9vrf3y.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, inject, isRef, mergeModels, mergeProps, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, resolveComponent, resolveDirective, toDisplayString, unref, useId, useModel, useTemplateRef, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
4
|
import { eventBus, globalObjects, injectDark, injectLocale, openNumberDlg, openPromptDlg, useColor, useSystem, useViewStack } from "x-essential-lib";
|
|
5
5
|
import { getElement, getItems, getPropertyDefault, getPropertyDefaultArray, getTag, getTypes, isHexColor, isThemeColor, makeSlotId, parseNumberUnit, pkgs, rules, themeColors, unwrapSlotId } from "x-runtime-lib";
|
|
@@ -166,9 +166,10 @@ function execProperty$1(keys, property, object, state, arrayIndex, isBranch, lea
|
|
|
166
166
|
warning: state.warning
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
if (property.ui)
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
if (property.ui) {
|
|
170
|
+
if (property.array && !leafArrayEntry) return execPropertyLeafArray(keys, property, object, state, arrayIndex, isBranch);
|
|
171
|
+
else return execPropertyLeafScalar(property, object, state, arrayIndex, isBranch);
|
|
172
|
+
} else if (property.array) return execPropertyBranchArray(keys, property, object, state, arrayIndex, isBranch);
|
|
172
173
|
else return execPropertyBranchScalar(keys, property, object, state, arrayIndex, isBranch);
|
|
173
174
|
}
|
|
174
175
|
function execPropertyBranchArray(keys, property, object, state, arrayIndex, isBranch) {
|
|
@@ -441,14 +442,25 @@ function resetProperty(root, properties, keys, changeEvent) {
|
|
|
441
442
|
if (!property) return;
|
|
442
443
|
if (property.ui) {
|
|
443
444
|
if (property.readonly || property.static) return;
|
|
444
|
-
if (property.array)
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
445
|
+
if (property.array) {
|
|
446
|
+
if (typeof lastKey === "string") {
|
|
447
|
+
const object = unpkgObject(root, keys.slice(0, -1));
|
|
448
|
+
if (!object) return;
|
|
449
|
+
const oldValue = object[lastKey];
|
|
450
|
+
const newValue = getPropertyDefaultArray(property);
|
|
451
|
+
if (!isEqual(newValue, oldValue)) {
|
|
452
|
+
object[lastKey] = newValue;
|
|
453
|
+
changeEvent(keys, newValue);
|
|
454
|
+
}
|
|
455
|
+
} else {
|
|
456
|
+
const object = unpkgObject(root, keys.slice(0, -1));
|
|
457
|
+
if (!object) return;
|
|
458
|
+
const oldValue = object[lastKey];
|
|
459
|
+
const newValue = getPropertyDefault(property);
|
|
460
|
+
if (!isEqual(newValue, oldValue)) {
|
|
461
|
+
object[lastKey] = newValue;
|
|
462
|
+
changeEvent(keys, newValue);
|
|
463
|
+
}
|
|
452
464
|
}
|
|
453
465
|
} else {
|
|
454
466
|
const object = unpkgObject(root, keys.slice(0, -1));
|
|
@@ -460,35 +472,26 @@ function resetProperty(root, properties, keys, changeEvent) {
|
|
|
460
472
|
changeEvent(keys, newValue);
|
|
461
473
|
}
|
|
462
474
|
}
|
|
463
|
-
|
|
475
|
+
} else if (property.array) {
|
|
476
|
+
if (typeof lastKey === "string") {
|
|
464
477
|
const object = unpkgObject(root, keys.slice(0, -1));
|
|
465
478
|
if (!object) return;
|
|
466
479
|
const oldValue = object[lastKey];
|
|
467
|
-
const newValue =
|
|
480
|
+
const newValue = getPropertyDefaultArray(property);
|
|
468
481
|
if (!isEqual(newValue, oldValue)) {
|
|
469
482
|
object[lastKey] = newValue;
|
|
470
483
|
changeEvent(keys, newValue);
|
|
471
484
|
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
const oldValue = object[lastKey];
|
|
477
|
-
const newValue = getPropertyDefaultArray(property);
|
|
478
|
-
if (!isEqual(newValue, oldValue)) {
|
|
479
|
-
object[lastKey] = newValue;
|
|
480
|
-
changeEvent(keys, newValue);
|
|
485
|
+
} else {
|
|
486
|
+
const object = unpkgObject(root, keys);
|
|
487
|
+
if (!object) return;
|
|
488
|
+
for (const child of property.children) execProperty(object, child, keys, changeEvent);
|
|
481
489
|
}
|
|
482
490
|
} else {
|
|
483
491
|
const object = unpkgObject(root, keys);
|
|
484
492
|
if (!object) return;
|
|
485
493
|
for (const child of property.children) execProperty(object, child, keys, changeEvent);
|
|
486
494
|
}
|
|
487
|
-
else {
|
|
488
|
-
const object = unpkgObject(root, keys);
|
|
489
|
-
if (!object) return;
|
|
490
|
-
for (const child of property.children) execProperty(object, child, keys, changeEvent);
|
|
491
|
-
}
|
|
492
495
|
}
|
|
493
496
|
|
|
494
497
|
//#endregion
|
|
@@ -1803,9 +1806,6 @@ var index_vue_vue_type_script_setup_true_lang_default$10 = /*@__PURE__*/ defineC
|
|
|
1803
1806
|
height: `calc(100% - ${h}px)`
|
|
1804
1807
|
};
|
|
1805
1808
|
});
|
|
1806
|
-
const title = computed(() => {
|
|
1807
|
-
return t("x-prop-tree.jsonEditor");
|
|
1808
|
-
});
|
|
1809
1809
|
const { open } = useViewStack(`propTreejsonEditorDlg${useId()}`);
|
|
1810
1810
|
onUnmounted(() => {
|
|
1811
1811
|
open.value = false;
|
|
@@ -1834,7 +1834,7 @@ var index_vue_vue_type_script_setup_true_lang_default$10 = /*@__PURE__*/ defineC
|
|
|
1834
1834
|
density: "comfortable",
|
|
1835
1835
|
readonly: __props.readonly
|
|
1836
1836
|
}), {
|
|
1837
|
-
default: withCtx(() => [createTextVNode(toDisplayString(
|
|
1837
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("x-prop-tree.json")), 1)]),
|
|
1838
1838
|
_: 1
|
|
1839
1839
|
}, 16, ["readonly"]), __props.hasDelete ? (openBlock(), createBlock(_component_v_btn, {
|
|
1840
1840
|
key: 0,
|
|
@@ -1867,7 +1867,7 @@ var index_vue_vue_type_script_setup_true_lang_default$10 = /*@__PURE__*/ defineC
|
|
|
1867
1867
|
variant: "text",
|
|
1868
1868
|
onClick: _cache[1] || (_cache[1] = ($event) => open.value = false)
|
|
1869
1869
|
}),
|
|
1870
|
-
createElementVNode("span", _hoisted_1$10, toDisplayString(
|
|
1870
|
+
createElementVNode("span", _hoisted_1$10, toDisplayString(unref(t)("x-prop-tree.jsonEditor")), 1),
|
|
1871
1871
|
createVNode(_component_v_spacer)
|
|
1872
1872
|
]),
|
|
1873
1873
|
_: 1
|
|
@@ -2320,8 +2320,10 @@ var index_vue_vue_type_script_setup_true_lang_default$7 = /*@__PURE__*/ defineCo
|
|
|
2320
2320
|
const parts = rule.value.split(",");
|
|
2321
2321
|
if (parts.length < 1) return;
|
|
2322
2322
|
select.value = parts[0];
|
|
2323
|
-
if (parts[0] === "minLength" || parts[1] === "maxLength" || parts[2] === "length")
|
|
2324
|
-
|
|
2323
|
+
if (parts[0] === "minLength" || parts[1] === "maxLength" || parts[2] === "length") {
|
|
2324
|
+
if (parts.length > 1) number.value = parseInt(parts[1]);
|
|
2325
|
+
else number.value = 0;
|
|
2326
|
+
}
|
|
2325
2327
|
});
|
|
2326
2328
|
function syncRule() {
|
|
2327
2329
|
if (select.value === "minLength" || select.value === "maxLength" || select.value === "length") rule.value = `${select.value},${number.value}`;
|
|
@@ -3273,9 +3275,10 @@ var main_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
3273
3275
|
if (isBranch) keys.push(property.key);
|
|
3274
3276
|
} else keys.push(property.key);
|
|
3275
3277
|
if (keys?.[0] === "runtime") return;
|
|
3276
|
-
if (property.ui)
|
|
3277
|
-
|
|
3278
|
-
|
|
3278
|
+
if (property.ui) {
|
|
3279
|
+
if (property.array && !leafArrayEntry) return renderLeafArray(keys, property, object, arrayIndex, isBranch);
|
|
3280
|
+
else return renderLeafScalar(keys, property, object, arrayIndex, isBranch);
|
|
3281
|
+
} else if (property.array) return renderBranchArray(keys, property, object, arrayIndex, isBranch);
|
|
3279
3282
|
else return renderBranchScalar(keys, property, object, arrayIndex, isBranch);
|
|
3280
3283
|
};
|
|
3281
3284
|
const renderBranchArray = (keys, property, object, arrayIndex, isBranch) => {
|
|
@@ -3531,10 +3534,11 @@ var index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
3531
3534
|
watchEffect(() => {
|
|
3532
3535
|
subtypeRef.value = __props.subtype;
|
|
3533
3536
|
});
|
|
3534
|
-
|
|
3537
|
+
const collapseState = ref({
|
|
3535
3538
|
collapse: true,
|
|
3536
3539
|
children: {}
|
|
3537
|
-
})
|
|
3540
|
+
});
|
|
3541
|
+
provideCollapseState(collapseState);
|
|
3538
3542
|
const propertyState = ref({
|
|
3539
3543
|
change: false,
|
|
3540
3544
|
warning: false,
|
|
@@ -3577,8 +3581,8 @@ const install = (app) => {
|
|
|
3577
3581
|
//#endregion
|
|
3578
3582
|
//#region src/i18n/index.ts
|
|
3579
3583
|
async function loadLocaleMessagePropTree(locale) {
|
|
3580
|
-
if (locale === "en") return (await import("./i18n-en.
|
|
3581
|
-
else if (locale === "zhHans") return (await import("./i18n-zhHans.
|
|
3584
|
+
if (locale === "en") return (await import("./i18n-en.fevhb1gv.js").then((n) => n.t)).default;
|
|
3585
|
+
else if (locale === "zhHans") return (await import("./i18n-zhHans.cro9uz6i.js").then((n) => n.t)).default;
|
|
3582
3586
|
else throw new Error(`invalid locale=${locale}`);
|
|
3583
3587
|
}
|
|
3584
3588
|
|