@piying/view-core 2.8.0 → 2.8.2
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/fesm2022/piying-view-core.mjs +66 -2
- package/fesm2022/piying-view-core.mjs.map +1 -1
- package/index.d.ts +11 -2
- package/package.json +1 -1
|
@@ -2127,6 +2127,61 @@ function nonFieldControl(value = true) {
|
|
|
2127
2127
|
};
|
|
2128
2128
|
}
|
|
2129
2129
|
|
|
2130
|
+
function findTopmostField(field) {
|
|
2131
|
+
const wrappers = field.wrappers();
|
|
2132
|
+
if (wrappers?.length) {
|
|
2133
|
+
return wrappers[0];
|
|
2134
|
+
}
|
|
2135
|
+
return field;
|
|
2136
|
+
}
|
|
2137
|
+
function createTopSetter(key, setter) {
|
|
2138
|
+
return rawConfig((rawField) => {
|
|
2139
|
+
mergeHooksFn({
|
|
2140
|
+
allFieldsResolved: (field) => {
|
|
2141
|
+
const topField = findTopmostField(field);
|
|
2142
|
+
const signal = topField[key];
|
|
2143
|
+
setter(signal);
|
|
2144
|
+
},
|
|
2145
|
+
}, { position: 'bottom' }, rawField);
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
// function createTopAsyncSetter<T>(
|
|
2149
|
+
// key: PositionKey,
|
|
2150
|
+
// getValueFn: (field: _PiResolvedCommonViewFieldConfig) => any,
|
|
2151
|
+
// ) {
|
|
2152
|
+
// return rawConfig<T>((rawField) => {
|
|
2153
|
+
// mergeHooksFn(
|
|
2154
|
+
// {
|
|
2155
|
+
// allFieldsResolved: (field) => {
|
|
2156
|
+
// const topField = findTopmostField(field);
|
|
2157
|
+
// const signal = topField[key];
|
|
2158
|
+
// const value = getValueFn(field);
|
|
2159
|
+
// signal.connect(key, value);
|
|
2160
|
+
// },
|
|
2161
|
+
// },
|
|
2162
|
+
// { position: 'bottom' },
|
|
2163
|
+
// rawField,
|
|
2164
|
+
// );
|
|
2165
|
+
// });
|
|
2166
|
+
// }
|
|
2167
|
+
function topSet(key, isPatch) {
|
|
2168
|
+
return (value) => createTopSetter(key, (signal) => {
|
|
2169
|
+
if (isPatch) {
|
|
2170
|
+
signal.update((current) => ({ ...current, ...value }));
|
|
2171
|
+
}
|
|
2172
|
+
else {
|
|
2173
|
+
signal.set(value);
|
|
2174
|
+
}
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
// function topAsync<T>(key: PositionKey, getValueFn: AsyncCallback<any>) {
|
|
2178
|
+
// return createTopAsyncSetter<T>(key, (field) => getValueFn(field));
|
|
2179
|
+
// }
|
|
2180
|
+
const top = {
|
|
2181
|
+
setOrPath: topSet,
|
|
2182
|
+
// async: topAsync,
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2130
2185
|
const CustomDataSymbol = Symbol();
|
|
2131
2186
|
const createRemovePropertyFn = (key) => (list) => rawConfig((rawField, _, ...args) => mergeHooksFn({
|
|
2132
2187
|
allFieldsResolved: (field) => {
|
|
@@ -2270,6 +2325,10 @@ const __actions = {
|
|
|
2270
2325
|
patchAsync: createPatchAsyncPropertyFn('attributes'),
|
|
2271
2326
|
remove: createRemovePropertyFn('attributes'),
|
|
2272
2327
|
mapAsync: createMapAsyncPropertyFn('attributes'),
|
|
2328
|
+
top: {
|
|
2329
|
+
set: top.setOrPath('attributes'),
|
|
2330
|
+
patch: top.setOrPath('attributes', true),
|
|
2331
|
+
},
|
|
2273
2332
|
},
|
|
2274
2333
|
events: {
|
|
2275
2334
|
patch: createSetOrPatchPropertyFn('events', true),
|
|
@@ -2865,12 +2924,17 @@ function convert(obj, options) {
|
|
|
2865
2924
|
});
|
|
2866
2925
|
}
|
|
2867
2926
|
|
|
2868
|
-
/** NonFieldControl
|
|
2927
|
+
/** NonFieldControl
|
|
2928
|
+
* 建议使用 nfcComponent => v.pipe(NFCSchema,setComponent(xxx))
|
|
2929
|
+
*/
|
|
2869
2930
|
const NFCSchema = v.optional(v.void());
|
|
2931
|
+
function nfcComponent(input) {
|
|
2932
|
+
return v.pipe(NFCSchema, setComponent(input));
|
|
2933
|
+
}
|
|
2870
2934
|
|
|
2871
2935
|
/**
|
|
2872
2936
|
* Generated bundle index. Do not edit.
|
|
2873
2937
|
*/
|
|
2874
2938
|
|
|
2875
|
-
export { AbstractControl, CoreSchemaHandle, CustomDataSymbol, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, InitPendingValue, NFCSchema, PENDING, PI_CONTEXT_TOKEN, PI_FORM_BUILDER_ALIAS_MAP, PI_FORM_BUILDER_OPTIONS_TOKEN, PI_VIEW_CONFIG_TOKEN, PI_VIEW_FIELD_TOKEN, SortedArray, UpdateType, VALID, actions, arrayStartsWith, asyncMergeOutputs, asyncObjectSignal, clone, combineSignal, controlStatusList, convert, createViewControlLink, disableWhen, effectListen, errorSummary, fieldControlStatusClass, findComponent, findError, formConfig, getDeepError, getLazyImport, hideWhen, initListen, isArray, isFieldArray, isFieldControl, isFieldGroup, isFieldLogicGroup, isGroup, isLazyMark, layout, lazyMark, mergeHooks, mergeHooksFn, mergeOutputFn, mergeOutputs, nonFieldControl, observableSignal, outputChange, outputChangeFn, patchHooks, rawConfig, removeHooks, renderConfig, setAlias, setComponent, setHooks, toArray, toObservable, valueChange, valueChangeFn, changeProviders as ɵchangeProviders, classAction as ɵclassAction, patchProviders as ɵpatchProviders, setProviders as ɵsetProviders, wrappers as ɵwrappers };
|
|
2939
|
+
export { AbstractControl, CoreSchemaHandle, CustomDataSymbol, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, InitPendingValue, NFCSchema, PENDING, PI_CONTEXT_TOKEN, PI_FORM_BUILDER_ALIAS_MAP, PI_FORM_BUILDER_OPTIONS_TOKEN, PI_VIEW_CONFIG_TOKEN, PI_VIEW_FIELD_TOKEN, SortedArray, UpdateType, VALID, actions, arrayStartsWith, asyncMergeOutputs, asyncObjectSignal, clone, combineSignal, controlStatusList, convert, createViewControlLink, disableWhen, effectListen, errorSummary, fieldControlStatusClass, findComponent, findError, formConfig, getDeepError, getLazyImport, hideWhen, initListen, isArray, isFieldArray, isFieldControl, isFieldGroup, isFieldLogicGroup, isGroup, isLazyMark, layout, lazyMark, mergeHooks, mergeHooksFn, mergeOutputFn, mergeOutputs, nfcComponent, nonFieldControl, observableSignal, outputChange, outputChangeFn, patchHooks, rawConfig, removeHooks, renderConfig, setAlias, setComponent, setHooks, toArray, toObservable, valueChange, valueChangeFn, changeProviders as ɵchangeProviders, classAction as ɵclassAction, patchProviders as ɵpatchProviders, setProviders as ɵsetProviders, wrappers as ɵwrappers };
|
|
2876
2940
|
//# sourceMappingURL=piying-view-core.mjs.map
|