x-prop-tree 0.8.30 → 0.8.31

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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
5
  jsonEditor: string;
@@ -19,4 +19,4 @@ declare const _default: {
19
19
  install: (app: import("vue").App) => void;
20
20
  };
21
21
  //#endregion
22
- export { _default as default, loadLocaleMessagePropTree };
22
+ 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.o2dszt6f.js";
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) if (property.array && !leafArrayEntry) return execPropertyLeafArray(keys, property, object, state, arrayIndex, isBranch);
170
- else return execPropertyLeafScalar(property, object, state, arrayIndex, isBranch);
171
- else if (property.array) return execPropertyBranchArray(keys, property, object, state, arrayIndex, isBranch);
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) if (typeof lastKey === "string") {
445
- const object = unpkgObject(root, keys.slice(0, -1));
446
- if (!object) return;
447
- const oldValue = object[lastKey];
448
- const newValue = getPropertyDefaultArray(property);
449
- if (!isEqual(newValue, oldValue)) {
450
- object[lastKey] = newValue;
451
- changeEvent(keys, newValue);
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
- else {
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 = getPropertyDefault(property);
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
- } else if (property.array) if (typeof lastKey === "string") {
474
- const object = unpkgObject(root, keys.slice(0, -1));
475
- if (!object) return;
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
@@ -2320,8 +2323,10 @@ var index_vue_vue_type_script_setup_true_lang_default$7 = /*@__PURE__*/ defineCo
2320
2323
  const parts = rule.value.split(",");
2321
2324
  if (parts.length < 1) return;
2322
2325
  select.value = parts[0];
2323
- if (parts[0] === "minLength" || parts[1] === "maxLength" || parts[2] === "length") if (parts.length > 1) number.value = parseInt(parts[1]);
2324
- else number.value = 0;
2326
+ if (parts[0] === "minLength" || parts[1] === "maxLength" || parts[2] === "length") {
2327
+ if (parts.length > 1) number.value = parseInt(parts[1]);
2328
+ else number.value = 0;
2329
+ }
2325
2330
  });
2326
2331
  function syncRule() {
2327
2332
  if (select.value === "minLength" || select.value === "maxLength" || select.value === "length") rule.value = `${select.value},${number.value}`;
@@ -3273,9 +3278,10 @@ var main_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
3273
3278
  if (isBranch) keys.push(property.key);
3274
3279
  } else keys.push(property.key);
3275
3280
  if (keys?.[0] === "runtime") return;
3276
- if (property.ui) if (property.array && !leafArrayEntry) return renderLeafArray(keys, property, object, arrayIndex, isBranch);
3277
- else return renderLeafScalar(keys, property, object, arrayIndex, isBranch);
3278
- else if (property.array) return renderBranchArray(keys, property, object, arrayIndex, isBranch);
3281
+ if (property.ui) {
3282
+ if (property.array && !leafArrayEntry) return renderLeafArray(keys, property, object, arrayIndex, isBranch);
3283
+ else return renderLeafScalar(keys, property, object, arrayIndex, isBranch);
3284
+ } else if (property.array) return renderBranchArray(keys, property, object, arrayIndex, isBranch);
3279
3285
  else return renderBranchScalar(keys, property, object, arrayIndex, isBranch);
3280
3286
  };
3281
3287
  const renderBranchArray = (keys, property, object, arrayIndex, isBranch) => {
@@ -3531,10 +3537,11 @@ var index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
3531
3537
  watchEffect(() => {
3532
3538
  subtypeRef.value = __props.subtype;
3533
3539
  });
3534
- provideCollapseState(ref({
3540
+ const collapseState = ref({
3535
3541
  collapse: true,
3536
3542
  children: {}
3537
- }));
3543
+ });
3544
+ provideCollapseState(collapseState);
3538
3545
  const propertyState = ref({
3539
3546
  change: false,
3540
3547
  warning: false,