3h1-ui 3.0.0-next.241 → 3.0.0-next.243

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/es/index.js CHANGED
@@ -12614,20 +12614,37 @@ function useFormEvents({
12614
12614
  return;
12615
12615
  }
12616
12616
  const schema = [];
12617
- unref(getSchema).forEach((val) => {
12618
- let _val;
12619
- updateData.forEach((item) => {
12620
- if (val.field === item.field) {
12621
- _val = item;
12617
+ function processSchemas(schemas, context = {}) {
12618
+ return schemas.map((schemaItem) => {
12619
+ const matched = updateData.find(
12620
+ (item) => item.field === schemaItem.field
12621
+ );
12622
+ let merged = matched ? deepMerge$2(schemaItem, matched) : schemaItem;
12623
+ const originalProps = merged.componentProps;
12624
+ if (typeof originalProps === "function") {
12625
+ const resultProps = originalProps(context);
12626
+ if (merged.component === "Group" && resultProps && Array.isArray(resultProps.schemas)) {
12627
+ const processedSchemas = processSchemas(
12628
+ resultProps.schemas,
12629
+ context
12630
+ );
12631
+ merged.componentProps = (ctx) => ({
12632
+ ...originalProps(ctx),
12633
+ schemas: processedSchemas
12634
+ });
12635
+ }
12622
12636
  }
12637
+ if (merged.componentProps && typeof originalProps === "object" && merged.component === "Group" && Array.isArray(originalProps.schemas)) {
12638
+ merged.componentProps.schemas = processSchemas(
12639
+ originalProps.schemas,
12640
+ context
12641
+ );
12642
+ }
12643
+ return merged;
12623
12644
  });
12624
- if (_val !== void 0 && val.field === _val.field) {
12625
- const newSchema = deepMerge$2(val, _val);
12626
- schema.push(newSchema);
12627
- } else {
12628
- schema.push(val);
12629
- }
12630
- });
12645
+ }
12646
+ const rawSchemas = unref(getSchema);
12647
+ schema.push(...processSchemas(rawSchemas));
12631
12648
  _setDefaultValue(schema);
12632
12649
  schemaRef.value = uniqBy(schema, "field");
12633
12650
  }
@@ -25866,28 +25883,27 @@ const ShyForm = /* @__PURE__ */ defineComponent({
25866
25883
  for (const key2 in val) {
25867
25884
  let handleSchemas = function(schemas = []) {
25868
25885
  schemas.forEach((item) => {
25869
- var _a2, _b;
25870
- const isComponentProps = item.field === key2 && item.componentProps;
25871
- if (isComponentProps && !isFunction$5(item.componentProps) && ((_a2 = item.componentProps) == null ? void 0 : _a2.onModelChange)) {
25872
- item.componentProps.onModelChange(val[key2]);
25873
- } else if (isComponentProps && isFunction$5(item.componentProps)) {
25874
- const modelProps = item.componentProps({
25875
- schema: item,
25876
- formModel,
25877
- formActionType,
25878
- tableAction: props2.tableAction
25879
- });
25880
- if (modelProps.onModelChange) {
25881
- modelProps.onModelChange(val[key2]);
25882
- }
25886
+ const isTargetField = item.field === key2;
25887
+ context.schema = item;
25888
+ const rawComponentProps = item.componentProps;
25889
+ const resolvedProps = isFunction$5(rawComponentProps) ? rawComponentProps(context) : rawComponentProps;
25890
+ if (isTargetField && (resolvedProps == null ? void 0 : resolvedProps.onModelChange)) {
25891
+ resolvedProps.onModelChange(val[key2]);
25883
25892
  }
25884
- if (item.component === "Group" && ((_b = item.componentProps) == null ? void 0 : _b.schemas)) {
25885
- handleSchemas(item.componentProps.schemas);
25893
+ if (item.component === "Group" && resolvedProps && Array.isArray(resolvedProps.schemas)) {
25894
+ handleSchemas(resolvedProps.schemas);
25886
25895
  }
25887
25896
  });
25888
25897
  };
25889
25898
  if (isEqual(toRaw(val[key2]), toRaw(tempFormModel[key2])))
25890
25899
  continue;
25900
+ const context = {
25901
+ schema: {},
25902
+ // 每次赋值
25903
+ formModel,
25904
+ formActionType,
25905
+ tableAction: props2.tableAction
25906
+ };
25891
25907
  handleSchemas(unref(getProps).schemas);
25892
25908
  }
25893
25909
  Object.assign(tempFormModel, cloneDeep(formModel));
package/es/style.css CHANGED
@@ -8445,6 +8445,7 @@ html[data-theme='dark'] .full-loading[data-v-ee545744]:not(.light) {
8445
8445
  .shy-basic-descriptions-divider-content {
8446
8446
  display: flex;
8447
8447
  width: 100%;
8448
+ flex-wrap: wrap;
8448
8449
  }
8449
8450
  .shy-basic-descriptions-group {
8450
8451
  display: flex;
@@ -1,2 +1,2 @@
1
- import type { DescriptionProps, UseDescReturnType } from './typing';
2
- export declare function useShyDescriptions(props?: Partial<DescriptionProps>): UseDescReturnType;
1
+ import type { DescriptionsProps, UseDescReturnType } from './typing';
2
+ export declare function useShyDescriptions(props?: Partial<DescriptionsProps>): UseDescReturnType;
package/lib/index.js CHANGED
@@ -12638,20 +12638,37 @@ function useFormEvents({
12638
12638
  return;
12639
12639
  }
12640
12640
  const schema = [];
12641
- vue.unref(getSchema).forEach((val) => {
12642
- let _val;
12643
- updateData.forEach((item) => {
12644
- if (val.field === item.field) {
12645
- _val = item;
12641
+ function processSchemas(schemas, context = {}) {
12642
+ return schemas.map((schemaItem) => {
12643
+ const matched = updateData.find(
12644
+ (item) => item.field === schemaItem.field
12645
+ );
12646
+ let merged = matched ? utils$1.deepMerge(schemaItem, matched) : schemaItem;
12647
+ const originalProps = merged.componentProps;
12648
+ if (typeof originalProps === "function") {
12649
+ const resultProps = originalProps(context);
12650
+ if (merged.component === "Group" && resultProps && Array.isArray(resultProps.schemas)) {
12651
+ const processedSchemas = processSchemas(
12652
+ resultProps.schemas,
12653
+ context
12654
+ );
12655
+ merged.componentProps = (ctx) => ({
12656
+ ...originalProps(ctx),
12657
+ schemas: processedSchemas
12658
+ });
12659
+ }
12646
12660
  }
12661
+ if (merged.componentProps && typeof originalProps === "object" && merged.component === "Group" && Array.isArray(originalProps.schemas)) {
12662
+ merged.componentProps.schemas = processSchemas(
12663
+ originalProps.schemas,
12664
+ context
12665
+ );
12666
+ }
12667
+ return merged;
12647
12668
  });
12648
- if (_val !== void 0 && val.field === _val.field) {
12649
- const newSchema = utils$1.deepMerge(val, _val);
12650
- schema.push(newSchema);
12651
- } else {
12652
- schema.push(val);
12653
- }
12654
- });
12669
+ }
12670
+ const rawSchemas = vue.unref(getSchema);
12671
+ schema.push(...processSchemas(rawSchemas));
12655
12672
  _setDefaultValue(schema);
12656
12673
  schemaRef.value = uniqBy(schema, "field");
12657
12674
  }
@@ -25890,28 +25907,27 @@ const ShyForm = /* @__PURE__ */ vue.defineComponent({
25890
25907
  for (const key2 in val) {
25891
25908
  let handleSchemas = function(schemas = []) {
25892
25909
  schemas.forEach((item) => {
25893
- var _a2, _b;
25894
- const isComponentProps = item.field === key2 && item.componentProps;
25895
- if (isComponentProps && !isFunction$5(item.componentProps) && ((_a2 = item.componentProps) == null ? void 0 : _a2.onModelChange)) {
25896
- item.componentProps.onModelChange(val[key2]);
25897
- } else if (isComponentProps && isFunction$5(item.componentProps)) {
25898
- const modelProps = item.componentProps({
25899
- schema: item,
25900
- formModel,
25901
- formActionType,
25902
- tableAction: props2.tableAction
25903
- });
25904
- if (modelProps.onModelChange) {
25905
- modelProps.onModelChange(val[key2]);
25906
- }
25910
+ const isTargetField = item.field === key2;
25911
+ context.schema = item;
25912
+ const rawComponentProps = item.componentProps;
25913
+ const resolvedProps = isFunction$5(rawComponentProps) ? rawComponentProps(context) : rawComponentProps;
25914
+ if (isTargetField && (resolvedProps == null ? void 0 : resolvedProps.onModelChange)) {
25915
+ resolvedProps.onModelChange(val[key2]);
25907
25916
  }
25908
- if (item.component === "Group" && ((_b = item.componentProps) == null ? void 0 : _b.schemas)) {
25909
- handleSchemas(item.componentProps.schemas);
25917
+ if (item.component === "Group" && resolvedProps && Array.isArray(resolvedProps.schemas)) {
25918
+ handleSchemas(resolvedProps.schemas);
25910
25919
  }
25911
25920
  });
25912
25921
  };
25913
25922
  if (isEqual(vue.toRaw(val[key2]), vue.toRaw(tempFormModel[key2])))
25914
25923
  continue;
25924
+ const context = {
25925
+ schema: {},
25926
+ // 每次赋值
25927
+ formModel,
25928
+ formActionType,
25929
+ tableAction: props2.tableAction
25930
+ };
25915
25931
  handleSchemas(vue.unref(getProps).schemas);
25916
25932
  }
25917
25933
  Object.assign(tempFormModel, cloneDeep(formModel));
package/lib/style.css CHANGED
@@ -8445,6 +8445,7 @@ html[data-theme='dark'] .full-loading[data-v-ee545744]:not(.light) {
8445
8445
  .shy-basic-descriptions-divider-content {
8446
8446
  display: flex;
8447
8447
  width: 100%;
8448
+ flex-wrap: wrap;
8448
8449
  }
8449
8450
  .shy-basic-descriptions-group {
8450
8451
  display: flex;
@@ -1,2 +1,2 @@
1
- import type { DescriptionProps, UseDescReturnType } from './typing';
2
- export declare function useShyDescriptions(props?: Partial<DescriptionProps>): UseDescReturnType;
1
+ import type { DescriptionsProps, UseDescReturnType } from './typing';
2
+ export declare function useShyDescriptions(props?: Partial<DescriptionsProps>): UseDescReturnType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "3.0.0-next.241",
3
+ "version": "3.0.0-next.243",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",