@piying/view-angular-core 2.0.3 → 2.0.5

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.
@@ -2085,52 +2085,56 @@ const __actions = {
2085
2085
  },
2086
2086
  };
2087
2087
 
2088
- function setWrappers(wrappers) {
2089
- return rawConfig((rawField, _) => {
2090
- const wrapperConfig = rawField.globalConfig.additionalData['defaultWrapperMetadataGroup'];
2091
- const injector = rawField.globalConfig.additionalData['injector'];
2092
- const OptionDefine = {
2093
- pipe: pipe(map((item) => {
2094
- if (typeof item.type === 'string') {
2095
- const type = wrapperConfig[item.type].type;
2096
- if (!type) {
2097
- throw new Error(`🈳wrapper:[${type}]❗`);
2088
+ function createSetOrPatchWrappersFn(isPatch) {
2089
+ return (wrappers) => {
2090
+ return rawConfig((rawField, _) => {
2091
+ const wrapperConfig = rawField.globalConfig.additionalData['defaultWrapperMetadataGroup'];
2092
+ const injector = rawField.globalConfig.additionalData['injector'];
2093
+ const OptionDefine = {
2094
+ pipe: pipe(map((item) => {
2095
+ if (typeof item.type === 'string') {
2096
+ const type = wrapperConfig[item.type].type;
2097
+ if (!type) {
2098
+ throw new Error(`🈳wrapper:[${type}]❗`);
2099
+ }
2100
+ return { ...item, type: type };
2098
2101
  }
2099
- return { ...item, type: type };
2100
- }
2101
- return item;
2102
- })),
2103
- injector: injector,
2104
- };
2105
- rawField.wrappers.clean();
2106
- wrappers.forEach((item) => {
2107
- if (typeof item === 'string') {
2108
- const defaultActions = wrapperConfig[item]?.actions ?? [];
2109
- const define = observableSignal({
2110
- type: item,
2111
- inputs: asyncObjectSignal({}),
2112
- outputs: asyncObjectSignal({}),
2113
- attributes: asyncObjectSignal({}),
2114
- events: asyncObjectSignal({}),
2115
- }, OptionDefine);
2116
- rawField.wrappers.add(define);
2117
- defaultActions.forEach((item) => {
2118
- item.value(rawField, _, {
2119
- [CustomDataSymbol]: define,
2120
- });
2121
- });
2122
- }
2123
- else {
2124
- rawField.wrappers.add(observableSignal({
2125
- type: item.type,
2126
- inputs: asyncObjectSignal(item.inputs ?? {}),
2127
- outputs: asyncObjectSignal(item.outputs ?? {}),
2128
- attributes: asyncObjectSignal(item.attributes ?? {}),
2129
- events: asyncObjectSignal(item.events ?? {}),
2130
- }, OptionDefine));
2102
+ return item;
2103
+ })),
2104
+ injector: injector,
2105
+ };
2106
+ if (!isPatch) {
2107
+ rawField.wrappers.clean();
2131
2108
  }
2109
+ wrappers.forEach((item) => {
2110
+ if (typeof item === 'string') {
2111
+ const defaultActions = wrapperConfig[item]?.actions ?? [];
2112
+ const define = observableSignal({
2113
+ type: item,
2114
+ inputs: asyncObjectSignal({}),
2115
+ outputs: asyncObjectSignal({}),
2116
+ attributes: asyncObjectSignal({}),
2117
+ events: asyncObjectSignal({}),
2118
+ }, OptionDefine);
2119
+ rawField.wrappers.add(define);
2120
+ defaultActions.forEach((item) => {
2121
+ item.value(rawField, _, {
2122
+ [CustomDataSymbol]: define,
2123
+ });
2124
+ });
2125
+ }
2126
+ else {
2127
+ rawField.wrappers.add(observableSignal({
2128
+ type: item.type,
2129
+ inputs: asyncObjectSignal(item.inputs ?? {}),
2130
+ outputs: asyncObjectSignal(item.outputs ?? {}),
2131
+ attributes: asyncObjectSignal(item.attributes ?? {}),
2132
+ events: asyncObjectSignal(item.events ?? {}),
2133
+ }, OptionDefine));
2134
+ }
2135
+ });
2132
2136
  });
2133
- });
2137
+ };
2134
2138
  }
2135
2139
  function removeWrappers(removeList) {
2136
2140
  return rawConfig((field) => {
@@ -2210,7 +2214,8 @@ function changeAsyncWrapper(indexFn, actions) {
2210
2214
  });
2211
2215
  }
2212
2216
  const wrappers = {
2213
- set: setWrappers,
2217
+ set: createSetOrPatchWrappersFn(),
2218
+ patch: createSetOrPatchWrappersFn(true),
2214
2219
  patchAsync: patchAsyncWrapper,
2215
2220
  remove: removeWrappers,
2216
2221
  changeAsync: changeAsyncWrapper,