@uniformdev/canvas 19.181.1 → 19.181.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/dist/index.d.mts +0 -24
- package/dist/index.d.ts +0 -24
- package/dist/index.esm.js +42 -27
- package/dist/index.js +42 -27
- package/dist/index.mjs +42 -27
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
@@ -27380,15 +27380,9 @@ declare const parseComponentPlaceholderId: (id: string) => {
|
|
27380
27380
|
parent?: PlaceholderParent;
|
27381
27381
|
} | undefined;
|
27382
27382
|
|
27383
|
-
/**
|
27384
|
-
* @deprecated do not use, will be removed in a future version
|
27385
|
-
*/
|
27386
27383
|
type FlattenProperty<P> = P extends {
|
27387
27384
|
value: unknown;
|
27388
27385
|
} ? P['value'] : P;
|
27389
|
-
/**
|
27390
|
-
* @deprecated do not use, will be removed in a future version
|
27391
|
-
*/
|
27392
27386
|
type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInstance, 'parameters'> ? Record<string, unknown> & {
|
27393
27387
|
[Property in keyof T['parameters']]: FlattenProperty<T['parameters'][Property]>;
|
27394
27388
|
} : T extends Pick<EntryData, 'fields'> ? Record<string, unknown> & {
|
@@ -27399,9 +27393,6 @@ type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInsta
|
|
27399
27393
|
* If no properties are defined, returns undefined.
|
27400
27394
|
*/
|
27401
27395
|
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
27402
|
-
/**
|
27403
|
-
* @deprecated do not use, will be removed in a future version
|
27404
|
-
*/
|
27405
27396
|
interface FlattenValuesOptions {
|
27406
27397
|
/**
|
27407
27398
|
* Take only the first item from an array
|
@@ -27447,27 +27438,12 @@ declare function getLocalizedPropertyValues<TValue, T extends ComponentParameter
|
|
27447
27438
|
declare function getLocalizedPropertyValues(parameter: null): null;
|
27448
27439
|
declare function getLocalizedPropertyValues(parameter: undefined): undefined;
|
27449
27440
|
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
27450
|
-
/**
|
27451
|
-
* @deprecated do not use, will be removed in a future version
|
27452
|
-
*/
|
27453
27441
|
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
27454
|
-
/**
|
27455
|
-
* @deprecated do not use, will be removed in a future version
|
27456
|
-
*/
|
27457
27442
|
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
27458
|
-
/**
|
27459
|
-
* @deprecated do not use, will be removed in a future version
|
27460
|
-
*/
|
27461
27443
|
declare function flattenValues<Data extends DataWithProperties>(data: Data | null | undefined, options?: FlattenValuesOptions): FlattenValues<Data> | null | undefined;
|
27462
|
-
/**
|
27463
|
-
* @deprecated do not use, will be removed in a future version
|
27464
|
-
*/
|
27465
27444
|
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options: {
|
27466
27445
|
toSingle: true;
|
27467
27446
|
} & Omit<FlattenValuesOptions, 'toSingle'>): FlattenValues<Data> | null | undefined;
|
27468
|
-
/**
|
27469
|
-
* @deprecated do not use, will be removed in a future version
|
27470
|
-
*/
|
27471
27447
|
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options?: FlattenValuesOptions): Array<FlattenValues<Data>> | null | undefined;
|
27472
27448
|
|
27473
27449
|
type BindVariablesResult<TValue> = {
|
package/dist/index.d.ts
CHANGED
@@ -27380,15 +27380,9 @@ declare const parseComponentPlaceholderId: (id: string) => {
|
|
27380
27380
|
parent?: PlaceholderParent;
|
27381
27381
|
} | undefined;
|
27382
27382
|
|
27383
|
-
/**
|
27384
|
-
* @deprecated do not use, will be removed in a future version
|
27385
|
-
*/
|
27386
27383
|
type FlattenProperty<P> = P extends {
|
27387
27384
|
value: unknown;
|
27388
27385
|
} ? P['value'] : P;
|
27389
|
-
/**
|
27390
|
-
* @deprecated do not use, will be removed in a future version
|
27391
|
-
*/
|
27392
27386
|
type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInstance, 'parameters'> ? Record<string, unknown> & {
|
27393
27387
|
[Property in keyof T['parameters']]: FlattenProperty<T['parameters'][Property]>;
|
27394
27388
|
} : T extends Pick<EntryData, 'fields'> ? Record<string, unknown> & {
|
@@ -27399,9 +27393,6 @@ type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInsta
|
|
27399
27393
|
* If no properties are defined, returns undefined.
|
27400
27394
|
*/
|
27401
27395
|
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
27402
|
-
/**
|
27403
|
-
* @deprecated do not use, will be removed in a future version
|
27404
|
-
*/
|
27405
27396
|
interface FlattenValuesOptions {
|
27406
27397
|
/**
|
27407
27398
|
* Take only the first item from an array
|
@@ -27447,27 +27438,12 @@ declare function getLocalizedPropertyValues<TValue, T extends ComponentParameter
|
|
27447
27438
|
declare function getLocalizedPropertyValues(parameter: null): null;
|
27448
27439
|
declare function getLocalizedPropertyValues(parameter: undefined): undefined;
|
27449
27440
|
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
27450
|
-
/**
|
27451
|
-
* @deprecated do not use, will be removed in a future version
|
27452
|
-
*/
|
27453
27441
|
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
27454
|
-
/**
|
27455
|
-
* @deprecated do not use, will be removed in a future version
|
27456
|
-
*/
|
27457
27442
|
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
27458
|
-
/**
|
27459
|
-
* @deprecated do not use, will be removed in a future version
|
27460
|
-
*/
|
27461
27443
|
declare function flattenValues<Data extends DataWithProperties>(data: Data | null | undefined, options?: FlattenValuesOptions): FlattenValues<Data> | null | undefined;
|
27462
|
-
/**
|
27463
|
-
* @deprecated do not use, will be removed in a future version
|
27464
|
-
*/
|
27465
27444
|
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options: {
|
27466
27445
|
toSingle: true;
|
27467
27446
|
} & Omit<FlattenValuesOptions, 'toSingle'>): FlattenValues<Data> | null | undefined;
|
27468
|
-
/**
|
27469
|
-
* @deprecated do not use, will be removed in a future version
|
27470
|
-
*/
|
27471
27447
|
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options?: FlattenValuesOptions): Array<FlattenValues<Data>> | null | undefined;
|
27472
27448
|
|
27473
27449
|
type BindVariablesResult<TValue> = {
|
package/dist/index.esm.js
CHANGED
@@ -1868,7 +1868,7 @@ function evaluateWalkTreePropertyCriteria({
|
|
1868
1868
|
...Object.keys((_b = property.localesConditions) != null ? _b : {})
|
1869
1869
|
];
|
1870
1870
|
localesDefined.forEach((locale) => {
|
1871
|
-
var _a2, _b2, _c2, _d, _e, _f
|
1871
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
1872
1872
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1873
1873
|
baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
|
1874
1874
|
conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
|
@@ -1876,25 +1876,25 @@ function evaluateWalkTreePropertyCriteria({
|
|
1876
1876
|
simplifyCriteria: true,
|
1877
1877
|
keepIndeterminate
|
1878
1878
|
});
|
1879
|
-
if (currentValue === null) {
|
1879
|
+
if (currentValue === null || currentValue === void 0) {
|
1880
1880
|
(_c2 = property.locales) == null ? true : delete _c2[locale];
|
1881
|
-
if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
|
1882
|
-
delete properties[propertyName];
|
1883
|
-
}
|
1884
1881
|
} else {
|
1885
|
-
(
|
1882
|
+
(_d = property.locales) != null ? _d : property.locales = {};
|
1886
1883
|
property.locales[locale] = currentValue;
|
1887
1884
|
}
|
1888
1885
|
if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
|
1889
|
-
(
|
1886
|
+
(_e = property.localesConditions) == null ? true : delete _e[locale];
|
1890
1887
|
} else {
|
1891
|
-
(
|
1888
|
+
(_f = property.localesConditions) != null ? _f : property.localesConditions = {};
|
1892
1889
|
property.localesConditions[locale] = remainingConditionalValues;
|
1893
1890
|
}
|
1894
1891
|
});
|
1895
1892
|
if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
|
1896
1893
|
delete property.localesConditions;
|
1897
1894
|
}
|
1895
|
+
if (!property.locales && !property.localesConditions) {
|
1896
|
+
delete properties[propertyName];
|
1897
|
+
}
|
1898
1898
|
} else {
|
1899
1899
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1900
1900
|
baseValue: property.value,
|
@@ -1906,9 +1906,17 @@ function evaluateWalkTreePropertyCriteria({
|
|
1906
1906
|
if (currentValue === null) {
|
1907
1907
|
delete properties[propertyName];
|
1908
1908
|
} else {
|
1909
|
-
|
1909
|
+
if (currentValue !== void 0) {
|
1910
|
+
property.value = currentValue;
|
1911
|
+
} else {
|
1912
|
+
delete property.value;
|
1913
|
+
}
|
1914
|
+
}
|
1915
|
+
if (remainingConditionalValues === void 0) {
|
1916
|
+
delete property.conditions;
|
1917
|
+
} else {
|
1918
|
+
property.conditions = remainingConditionalValues;
|
1910
1919
|
}
|
1911
|
-
property.conditions = remainingConditionalValues;
|
1912
1920
|
}
|
1913
1921
|
});
|
1914
1922
|
}
|
@@ -2078,7 +2086,7 @@ function localize(options) {
|
|
2078
2086
|
const { type, node, actions } = context;
|
2079
2087
|
if (type !== "component") {
|
2080
2088
|
if (isUsingModernOptions) {
|
2081
|
-
localizeProperties(node
|
2089
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2082
2090
|
}
|
2083
2091
|
return;
|
2084
2092
|
}
|
@@ -2091,11 +2099,6 @@ function localize(options) {
|
|
2091
2099
|
if (!result) {
|
2092
2100
|
return;
|
2093
2101
|
}
|
2094
|
-
evaluateWalkTreePropertyCriteria({
|
2095
|
-
node: context.node,
|
2096
|
-
rules: vizControlLocaleRule,
|
2097
|
-
keepIndeterminate: true
|
2098
|
-
});
|
2099
2102
|
}
|
2100
2103
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2101
2104
|
const locales = extractLocales({ component: node });
|
@@ -2108,7 +2111,7 @@ function localize(options) {
|
|
2108
2111
|
replaceComponent.forEach((component) => {
|
2109
2112
|
removeLocaleProperty(component);
|
2110
2113
|
if (isUsingModernOptions) {
|
2111
|
-
localizeProperties(
|
2114
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2112
2115
|
}
|
2113
2116
|
});
|
2114
2117
|
const [first, ...rest] = replaceComponent;
|
@@ -2120,7 +2123,7 @@ function localize(options) {
|
|
2120
2123
|
actions.remove();
|
2121
2124
|
}
|
2122
2125
|
} else if (isUsingModernOptions) {
|
2123
|
-
localizeProperties(
|
2126
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2124
2127
|
}
|
2125
2128
|
});
|
2126
2129
|
}
|
@@ -2139,24 +2142,36 @@ function removeLocaleProperty(component) {
|
|
2139
2142
|
}
|
2140
2143
|
}
|
2141
2144
|
}
|
2142
|
-
function localizeProperties(
|
2145
|
+
function localizeProperties(node, locale, rules) {
|
2146
|
+
const properties = getPropertiesValue(node);
|
2143
2147
|
if (!properties) {
|
2144
2148
|
return void 0;
|
2145
2149
|
}
|
2146
|
-
Object.entries(properties).forEach(([
|
2147
|
-
var _a;
|
2150
|
+
Object.entries(properties).forEach(([propertyId, propertyValue]) => {
|
2151
|
+
var _a, _b;
|
2148
2152
|
if (!locale) {
|
2149
|
-
delete
|
2153
|
+
delete propertyValue.locales;
|
2154
|
+
delete propertyValue.localesConditions;
|
2150
2155
|
}
|
2151
|
-
const currentLocaleValue = locale ? (_a =
|
2156
|
+
const currentLocaleValue = locale ? (_a = propertyValue.locales) == null ? void 0 : _a[locale] : void 0;
|
2152
2157
|
if (currentLocaleValue !== void 0) {
|
2153
|
-
|
2158
|
+
propertyValue.value = currentLocaleValue;
|
2159
|
+
}
|
2160
|
+
const currentLocaleConditionalValues = locale ? (_b = propertyValue.localesConditions) == null ? void 0 : _b[locale] : void 0;
|
2161
|
+
if (currentLocaleConditionalValues !== void 0) {
|
2162
|
+
propertyValue.conditions = currentLocaleConditionalValues;
|
2154
2163
|
}
|
2155
|
-
delete
|
2156
|
-
|
2157
|
-
|
2164
|
+
delete propertyValue.locales;
|
2165
|
+
delete propertyValue.localesConditions;
|
2166
|
+
if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
|
2167
|
+
delete properties[propertyId];
|
2158
2168
|
}
|
2159
2169
|
});
|
2170
|
+
evaluateWalkTreePropertyCriteria({
|
2171
|
+
node,
|
2172
|
+
rules,
|
2173
|
+
keepIndeterminate: true
|
2174
|
+
});
|
2160
2175
|
}
|
2161
2176
|
|
2162
2177
|
// src/enhancement/UniqueBatchEntries.ts
|
package/dist/index.js
CHANGED
@@ -2023,7 +2023,7 @@ function evaluateWalkTreePropertyCriteria({
|
|
2023
2023
|
...Object.keys((_b = property.localesConditions) != null ? _b : {})
|
2024
2024
|
];
|
2025
2025
|
localesDefined.forEach((locale) => {
|
2026
|
-
var _a2, _b2, _c2, _d, _e, _f
|
2026
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
2027
2027
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
2028
2028
|
baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
|
2029
2029
|
conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
|
@@ -2031,25 +2031,25 @@ function evaluateWalkTreePropertyCriteria({
|
|
2031
2031
|
simplifyCriteria: true,
|
2032
2032
|
keepIndeterminate
|
2033
2033
|
});
|
2034
|
-
if (currentValue === null) {
|
2034
|
+
if (currentValue === null || currentValue === void 0) {
|
2035
2035
|
(_c2 = property.locales) == null ? true : delete _c2[locale];
|
2036
|
-
if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
|
2037
|
-
delete properties[propertyName];
|
2038
|
-
}
|
2039
2036
|
} else {
|
2040
|
-
(
|
2037
|
+
(_d = property.locales) != null ? _d : property.locales = {};
|
2041
2038
|
property.locales[locale] = currentValue;
|
2042
2039
|
}
|
2043
2040
|
if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
|
2044
|
-
(
|
2041
|
+
(_e = property.localesConditions) == null ? true : delete _e[locale];
|
2045
2042
|
} else {
|
2046
|
-
(
|
2043
|
+
(_f = property.localesConditions) != null ? _f : property.localesConditions = {};
|
2047
2044
|
property.localesConditions[locale] = remainingConditionalValues;
|
2048
2045
|
}
|
2049
2046
|
});
|
2050
2047
|
if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
|
2051
2048
|
delete property.localesConditions;
|
2052
2049
|
}
|
2050
|
+
if (!property.locales && !property.localesConditions) {
|
2051
|
+
delete properties[propertyName];
|
2052
|
+
}
|
2053
2053
|
} else {
|
2054
2054
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
2055
2055
|
baseValue: property.value,
|
@@ -2061,9 +2061,17 @@ function evaluateWalkTreePropertyCriteria({
|
|
2061
2061
|
if (currentValue === null) {
|
2062
2062
|
delete properties[propertyName];
|
2063
2063
|
} else {
|
2064
|
-
|
2064
|
+
if (currentValue !== void 0) {
|
2065
|
+
property.value = currentValue;
|
2066
|
+
} else {
|
2067
|
+
delete property.value;
|
2068
|
+
}
|
2069
|
+
}
|
2070
|
+
if (remainingConditionalValues === void 0) {
|
2071
|
+
delete property.conditions;
|
2072
|
+
} else {
|
2073
|
+
property.conditions = remainingConditionalValues;
|
2065
2074
|
}
|
2066
|
-
property.conditions = remainingConditionalValues;
|
2067
2075
|
}
|
2068
2076
|
});
|
2069
2077
|
}
|
@@ -2233,7 +2241,7 @@ function localize(options) {
|
|
2233
2241
|
const { type, node, actions } = context;
|
2234
2242
|
if (type !== "component") {
|
2235
2243
|
if (isUsingModernOptions) {
|
2236
|
-
localizeProperties(node
|
2244
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2237
2245
|
}
|
2238
2246
|
return;
|
2239
2247
|
}
|
@@ -2246,11 +2254,6 @@ function localize(options) {
|
|
2246
2254
|
if (!result) {
|
2247
2255
|
return;
|
2248
2256
|
}
|
2249
|
-
evaluateWalkTreePropertyCriteria({
|
2250
|
-
node: context.node,
|
2251
|
-
rules: vizControlLocaleRule,
|
2252
|
-
keepIndeterminate: true
|
2253
|
-
});
|
2254
2257
|
}
|
2255
2258
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2256
2259
|
const locales = extractLocales({ component: node });
|
@@ -2263,7 +2266,7 @@ function localize(options) {
|
|
2263
2266
|
replaceComponent.forEach((component) => {
|
2264
2267
|
removeLocaleProperty(component);
|
2265
2268
|
if (isUsingModernOptions) {
|
2266
|
-
localizeProperties(
|
2269
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2267
2270
|
}
|
2268
2271
|
});
|
2269
2272
|
const [first, ...rest] = replaceComponent;
|
@@ -2275,7 +2278,7 @@ function localize(options) {
|
|
2275
2278
|
actions.remove();
|
2276
2279
|
}
|
2277
2280
|
} else if (isUsingModernOptions) {
|
2278
|
-
localizeProperties(
|
2281
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2279
2282
|
}
|
2280
2283
|
});
|
2281
2284
|
}
|
@@ -2294,24 +2297,36 @@ function removeLocaleProperty(component) {
|
|
2294
2297
|
}
|
2295
2298
|
}
|
2296
2299
|
}
|
2297
|
-
function localizeProperties(
|
2300
|
+
function localizeProperties(node, locale, rules) {
|
2301
|
+
const properties = getPropertiesValue(node);
|
2298
2302
|
if (!properties) {
|
2299
2303
|
return void 0;
|
2300
2304
|
}
|
2301
|
-
Object.entries(properties).forEach(([
|
2302
|
-
var _a;
|
2305
|
+
Object.entries(properties).forEach(([propertyId, propertyValue]) => {
|
2306
|
+
var _a, _b;
|
2303
2307
|
if (!locale) {
|
2304
|
-
delete
|
2308
|
+
delete propertyValue.locales;
|
2309
|
+
delete propertyValue.localesConditions;
|
2305
2310
|
}
|
2306
|
-
const currentLocaleValue = locale ? (_a =
|
2311
|
+
const currentLocaleValue = locale ? (_a = propertyValue.locales) == null ? void 0 : _a[locale] : void 0;
|
2307
2312
|
if (currentLocaleValue !== void 0) {
|
2308
|
-
|
2313
|
+
propertyValue.value = currentLocaleValue;
|
2314
|
+
}
|
2315
|
+
const currentLocaleConditionalValues = locale ? (_b = propertyValue.localesConditions) == null ? void 0 : _b[locale] : void 0;
|
2316
|
+
if (currentLocaleConditionalValues !== void 0) {
|
2317
|
+
propertyValue.conditions = currentLocaleConditionalValues;
|
2309
2318
|
}
|
2310
|
-
delete
|
2311
|
-
|
2312
|
-
|
2319
|
+
delete propertyValue.locales;
|
2320
|
+
delete propertyValue.localesConditions;
|
2321
|
+
if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
|
2322
|
+
delete properties[propertyId];
|
2313
2323
|
}
|
2314
2324
|
});
|
2325
|
+
evaluateWalkTreePropertyCriteria({
|
2326
|
+
node,
|
2327
|
+
rules,
|
2328
|
+
keepIndeterminate: true
|
2329
|
+
});
|
2315
2330
|
}
|
2316
2331
|
|
2317
2332
|
// src/enhancement/UniqueBatchEntries.ts
|
package/dist/index.mjs
CHANGED
@@ -1868,7 +1868,7 @@ function evaluateWalkTreePropertyCriteria({
|
|
1868
1868
|
...Object.keys((_b = property.localesConditions) != null ? _b : {})
|
1869
1869
|
];
|
1870
1870
|
localesDefined.forEach((locale) => {
|
1871
|
-
var _a2, _b2, _c2, _d, _e, _f
|
1871
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
1872
1872
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1873
1873
|
baseValue: (_a2 = property.locales) == null ? void 0 : _a2[locale],
|
1874
1874
|
conditionalValues: (_b2 = property.localesConditions) == null ? void 0 : _b2[locale],
|
@@ -1876,25 +1876,25 @@ function evaluateWalkTreePropertyCriteria({
|
|
1876
1876
|
simplifyCriteria: true,
|
1877
1877
|
keepIndeterminate
|
1878
1878
|
});
|
1879
|
-
if (currentValue === null) {
|
1879
|
+
if (currentValue === null || currentValue === void 0) {
|
1880
1880
|
(_c2 = property.locales) == null ? true : delete _c2[locale];
|
1881
|
-
if (!Object.keys((_d = property.locales) != null ? _d : {}).length) {
|
1882
|
-
delete properties[propertyName];
|
1883
|
-
}
|
1884
1881
|
} else {
|
1885
|
-
(
|
1882
|
+
(_d = property.locales) != null ? _d : property.locales = {};
|
1886
1883
|
property.locales[locale] = currentValue;
|
1887
1884
|
}
|
1888
1885
|
if (!(remainingConditionalValues == null ? void 0 : remainingConditionalValues.length)) {
|
1889
|
-
(
|
1886
|
+
(_e = property.localesConditions) == null ? true : delete _e[locale];
|
1890
1887
|
} else {
|
1891
|
-
(
|
1888
|
+
(_f = property.localesConditions) != null ? _f : property.localesConditions = {};
|
1892
1889
|
property.localesConditions[locale] = remainingConditionalValues;
|
1893
1890
|
}
|
1894
1891
|
});
|
1895
1892
|
if (!Object.keys((_c = property.localesConditions) != null ? _c : {}).length) {
|
1896
1893
|
delete property.localesConditions;
|
1897
1894
|
}
|
1895
|
+
if (!property.locales && !property.localesConditions) {
|
1896
|
+
delete properties[propertyName];
|
1897
|
+
}
|
1898
1898
|
} else {
|
1899
1899
|
const { currentValue, remainingConditionalValues } = evaluatePropertyCriteria({
|
1900
1900
|
baseValue: property.value,
|
@@ -1906,9 +1906,17 @@ function evaluateWalkTreePropertyCriteria({
|
|
1906
1906
|
if (currentValue === null) {
|
1907
1907
|
delete properties[propertyName];
|
1908
1908
|
} else {
|
1909
|
-
|
1909
|
+
if (currentValue !== void 0) {
|
1910
|
+
property.value = currentValue;
|
1911
|
+
} else {
|
1912
|
+
delete property.value;
|
1913
|
+
}
|
1914
|
+
}
|
1915
|
+
if (remainingConditionalValues === void 0) {
|
1916
|
+
delete property.conditions;
|
1917
|
+
} else {
|
1918
|
+
property.conditions = remainingConditionalValues;
|
1910
1919
|
}
|
1911
|
-
property.conditions = remainingConditionalValues;
|
1912
1920
|
}
|
1913
1921
|
});
|
1914
1922
|
}
|
@@ -2078,7 +2086,7 @@ function localize(options) {
|
|
2078
2086
|
const { type, node, actions } = context;
|
2079
2087
|
if (type !== "component") {
|
2080
2088
|
if (isUsingModernOptions) {
|
2081
|
-
localizeProperties(node
|
2089
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2082
2090
|
}
|
2083
2091
|
return;
|
2084
2092
|
}
|
@@ -2091,11 +2099,6 @@ function localize(options) {
|
|
2091
2099
|
if (!result) {
|
2092
2100
|
return;
|
2093
2101
|
}
|
2094
|
-
evaluateWalkTreePropertyCriteria({
|
2095
|
-
node: context.node,
|
2096
|
-
rules: vizControlLocaleRule,
|
2097
|
-
keepIndeterminate: true
|
2098
|
-
});
|
2099
2102
|
}
|
2100
2103
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2101
2104
|
const locales = extractLocales({ component: node });
|
@@ -2108,7 +2111,7 @@ function localize(options) {
|
|
2108
2111
|
replaceComponent.forEach((component) => {
|
2109
2112
|
removeLocaleProperty(component);
|
2110
2113
|
if (isUsingModernOptions) {
|
2111
|
-
localizeProperties(
|
2114
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2112
2115
|
}
|
2113
2116
|
});
|
2114
2117
|
const [first, ...rest] = replaceComponent;
|
@@ -2120,7 +2123,7 @@ function localize(options) {
|
|
2120
2123
|
actions.remove();
|
2121
2124
|
}
|
2122
2125
|
} else if (isUsingModernOptions) {
|
2123
|
-
localizeProperties(
|
2126
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2124
2127
|
}
|
2125
2128
|
});
|
2126
2129
|
}
|
@@ -2139,24 +2142,36 @@ function removeLocaleProperty(component) {
|
|
2139
2142
|
}
|
2140
2143
|
}
|
2141
2144
|
}
|
2142
|
-
function localizeProperties(
|
2145
|
+
function localizeProperties(node, locale, rules) {
|
2146
|
+
const properties = getPropertiesValue(node);
|
2143
2147
|
if (!properties) {
|
2144
2148
|
return void 0;
|
2145
2149
|
}
|
2146
|
-
Object.entries(properties).forEach(([
|
2147
|
-
var _a;
|
2150
|
+
Object.entries(properties).forEach(([propertyId, propertyValue]) => {
|
2151
|
+
var _a, _b;
|
2148
2152
|
if (!locale) {
|
2149
|
-
delete
|
2153
|
+
delete propertyValue.locales;
|
2154
|
+
delete propertyValue.localesConditions;
|
2150
2155
|
}
|
2151
|
-
const currentLocaleValue = locale ? (_a =
|
2156
|
+
const currentLocaleValue = locale ? (_a = propertyValue.locales) == null ? void 0 : _a[locale] : void 0;
|
2152
2157
|
if (currentLocaleValue !== void 0) {
|
2153
|
-
|
2158
|
+
propertyValue.value = currentLocaleValue;
|
2159
|
+
}
|
2160
|
+
const currentLocaleConditionalValues = locale ? (_b = propertyValue.localesConditions) == null ? void 0 : _b[locale] : void 0;
|
2161
|
+
if (currentLocaleConditionalValues !== void 0) {
|
2162
|
+
propertyValue.conditions = currentLocaleConditionalValues;
|
2154
2163
|
}
|
2155
|
-
delete
|
2156
|
-
|
2157
|
-
|
2164
|
+
delete propertyValue.locales;
|
2165
|
+
delete propertyValue.localesConditions;
|
2166
|
+
if (propertyValue.value === void 0 && propertyValue.conditions === void 0) {
|
2167
|
+
delete properties[propertyId];
|
2158
2168
|
}
|
2159
2169
|
});
|
2170
|
+
evaluateWalkTreePropertyCriteria({
|
2171
|
+
node,
|
2172
|
+
rules,
|
2173
|
+
keepIndeterminate: true
|
2174
|
+
});
|
2160
2175
|
}
|
2161
2176
|
|
2162
2177
|
// src/enhancement/UniqueBatchEntries.ts
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.181.
|
3
|
+
"version": "19.181.2",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -38,9 +38,9 @@
|
|
38
38
|
"pusher-js": "8.2.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "19.181.
|
42
|
-
"@uniformdev/context": "19.181.
|
43
|
-
"@uniformdev/richtext": "19.181.
|
41
|
+
"@uniformdev/assets": "19.181.2",
|
42
|
+
"@uniformdev/context": "19.181.2",
|
43
|
+
"@uniformdev/richtext": "19.181.2",
|
44
44
|
"immer": "10.1.1"
|
45
45
|
},
|
46
46
|
"files": [
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"publishConfig": {
|
50
50
|
"access": "public"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "89ffb2d1ab09ac3cb09b3928194352e358ef7f07"
|
53
53
|
}
|