@wavemaker/app-ng-runtime 11.14.1-1.6289 → 11.14.1-3.6306
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/components/base/bundles/index.umd.js +87 -17
- package/components/base/esm2022/pipes/custom-pipes.mjs +10 -10
- package/components/base/esm2022/utils/widget-utils.mjs +3 -3
- package/components/base/esm2022/widgets/common/base/base.component.mjs +68 -7
- package/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +7 -3
- package/components/base/esm2022/widgets/framework/property-change-handler.mjs +7 -2
- package/components/base/fesm2022/index.mjs +88 -18
- package/components/base/fesm2022/index.mjs.map +1 -1
- package/components/base/pipes/custom-pipes.d.ts +5 -5
- package/components/basic/label/bundles/index.umd.js +9 -1
- package/components/basic/label/esm2022/label.directive.mjs +10 -2
- package/components/basic/label/fesm2022/index.mjs +9 -1
- package/components/basic/label/fesm2022/index.mjs.map +1 -1
- package/components/data/table/bundles/index.umd.js +218 -11
- package/components/data/table/esm2022/table.component.mjs +219 -12
- package/components/data/table/fesm2022/index.mjs +218 -11
- package/components/data/table/fesm2022/index.mjs.map +1 -1
- package/components/data/table/table.component.d.ts +6 -2
- package/components/navigation/menu/bundles/index.umd.js +5 -0
- package/components/navigation/menu/esm2022/menu.component.mjs +6 -1
- package/components/navigation/menu/fesm2022/index.mjs +5 -0
- package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
- package/components/navigation/popover/bundles/index.umd.js +6 -6
- package/components/navigation/popover/esm2022/popover.component.mjs +4 -4
- package/components/navigation/popover/fesm2022/index.mjs +3 -3
- package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
- package/components/navigation/popover/popover.component.d.ts +6 -0
- package/core/bundles/index.umd.js +332 -82
- package/core/esm2022/public_api.mjs +3 -3
- package/core/esm2022/utils/utils.mjs +6 -2
- package/core/esm2022/utils/watcher.mjs +323 -81
- package/core/fesm2022/index.mjs +331 -84
- package/core/fesm2022/index.mjs.map +1 -1
- package/core/public_api.d.ts +2 -2
- package/core/utils/utils.d.ts +1 -0
- package/core/utils/watcher.d.ts +26 -5
- package/npm-shrinkwrap.json +2 -2
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/runtime/base/bundles/index.umd.js +37 -2
- package/runtime/base/esm2022/components/app-component/app.component.mjs +7 -2
- package/runtime/base/esm2022/components/base-page.component.mjs +9 -2
- package/runtime/base/esm2022/components/base-partial.component.mjs +10 -2
- package/runtime/base/esm2022/components/base-prefab.component.mjs +10 -2
- package/runtime/base/esm2022/components/base-spa-page.component.mjs +9 -2
- package/runtime/base/esm2022/services/pipe-provider.service.mjs +4 -4
- package/runtime/base/fesm2022/index.mjs +38 -3
- package/runtime/base/fesm2022/index.mjs.map +1 -1
- package/scripts/datatable/datatable.js +19 -2
package/core/fesm2022/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Attribute, ImplicitReceiver, PropertyRead, LiteralPrimitive, LiteralArray, LiteralMap, PropertyWrite, KeyedRead, PrefixNot, Unary, Binary, Conditional, Call, Chain, BindingPipe, Parser, Lexer } from '@angular/compiler';
|
|
2
|
-
import { isArray, startsWith, includes, get, flatten, isEqual, isObject as isObject$1,
|
|
2
|
+
import { isArray, startsWith, includes, get, flatten, isEqual, clone, isObject as isObject$1, camelCase, split, map, attempt, isError, isFunction, isDate, isString, cloneDeep, identity, intersection, omit, keys, toLower, replace as replace$1, forEach, trim, isEqualWith, every, indexOf, isNumber, filter, isUndefined, isNull, noop as noop$2, toUpper, assign, merge, isEmpty, debounce as debounce$1, isNil } from 'lodash-es';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
import X2JS from 'x2js';
|
|
5
5
|
import * as momentLib from 'moment-timezone/moment-timezone';
|
|
@@ -1432,11 +1432,11 @@ const CURRENCY_INFO = {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
};
|
|
1434
1434
|
|
|
1435
|
-
const $RAF
|
|
1435
|
+
const $RAF = window.requestAnimationFrame;
|
|
1436
1436
|
const $RAFQueue = [];
|
|
1437
1437
|
const invokeLater = fn => {
|
|
1438
1438
|
if (!$RAFQueue.length) {
|
|
1439
|
-
$RAF
|
|
1439
|
+
$RAF(() => {
|
|
1440
1440
|
$RAFQueue.forEach(f => f());
|
|
1441
1441
|
$RAFQueue.length = 0;
|
|
1442
1442
|
});
|
|
@@ -2173,14 +2173,25 @@ const getFnForEventExpr = (expr) => {
|
|
|
2173
2173
|
return fnExecutor(expr, ExpressionType.Action);
|
|
2174
2174
|
};
|
|
2175
2175
|
|
|
2176
|
+
// Constants
|
|
2177
|
+
const WIDGET_ID_REGEX = /^(widget-[^_]+)/;
|
|
2178
|
+
const WIDGET_PROPERTY_REGEX = /^widget-[^_]+_(.+)$/;
|
|
2179
|
+
const ARRAY_INDEX_PLACEHOLDER = '[$i]';
|
|
2180
|
+
const ARRAY_INDEX_ZERO = '[0]';
|
|
2181
|
+
const DEBOUNCE_WAIT = 100;
|
|
2182
|
+
const MAX_WATCH_CYCLES = 5;
|
|
2176
2183
|
const registry = new Map();
|
|
2177
2184
|
const watchIdGenerator = new IDGenerator('watch-id-');
|
|
2178
|
-
const FIRST_TIME_WATCH = {};
|
|
2179
|
-
|
|
2180
|
-
const isFirstTimeChange = v => v === FIRST_TIME_WATCH;
|
|
2185
|
+
const FIRST_TIME_WATCH = Object.freeze({});
|
|
2186
|
+
// State
|
|
2181
2187
|
let muted = false;
|
|
2188
|
+
let changedByWatch = false;
|
|
2189
|
+
let skipWatchers = false;
|
|
2190
|
+
let ngZone;
|
|
2182
2191
|
let appRef;
|
|
2183
|
-
|
|
2192
|
+
// Utility functions
|
|
2193
|
+
const isFirstTimeChange = (v) => v === FIRST_TIME_WATCH;
|
|
2194
|
+
const debounce = (fn, wait = DEBOUNCE_WAIT) => {
|
|
2184
2195
|
let timeout;
|
|
2185
2196
|
return (...args) => {
|
|
2186
2197
|
window['__zone_symbol__clearTimeout'](timeout);
|
|
@@ -2194,115 +2205,345 @@ const unMuteWatchers = () => {
|
|
|
2194
2205
|
muted = false;
|
|
2195
2206
|
triggerWatchers();
|
|
2196
2207
|
};
|
|
2208
|
+
/**
|
|
2209
|
+
* Extracts widget ID from identifier (e.g., "widget-id23_eventsource" -> "widget-id23")
|
|
2210
|
+
*/
|
|
2211
|
+
const getWidgetId = (identifier) => {
|
|
2212
|
+
if (!identifier || typeof identifier !== 'string') {
|
|
2213
|
+
return null;
|
|
2214
|
+
}
|
|
2215
|
+
const match = identifier.match(WIDGET_ID_REGEX);
|
|
2216
|
+
return match ? match[1] : null;
|
|
2217
|
+
};
|
|
2218
|
+
/**
|
|
2219
|
+
* Extracts property name from identifier (e.g., "widget-id23_eventsource" -> "eventsource")
|
|
2220
|
+
*/
|
|
2221
|
+
const getPropertyName = (identifier) => {
|
|
2222
|
+
if (!identifier || typeof identifier !== 'string') {
|
|
2223
|
+
return identifier;
|
|
2224
|
+
}
|
|
2225
|
+
const match = identifier.match(WIDGET_PROPERTY_REGEX);
|
|
2226
|
+
return match ? match[1] : identifier;
|
|
2227
|
+
};
|
|
2228
|
+
/**
|
|
2229
|
+
* Array consumer wrapper for array-based expressions
|
|
2230
|
+
*/
|
|
2197
2231
|
const arrayConsumer = (listenerFn, restExpr, newVal, oldVal) => {
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
formattedData = data.map(function (datum) {
|
|
2201
|
-
return findValueOf(datum, restExpr);
|
|
2202
|
-
});
|
|
2203
|
-
// If resulting structure is an array of array, flatten it
|
|
2204
|
-
if (isArray(formattedData[0])) {
|
|
2205
|
-
formattedData = flatten(formattedData);
|
|
2206
|
-
}
|
|
2207
|
-
listenerFn(formattedData, oldVal);
|
|
2232
|
+
if (!isArray(newVal)) {
|
|
2233
|
+
return;
|
|
2208
2234
|
}
|
|
2235
|
+
let formattedData = newVal.map(datum => findValueOf(datum, restExpr));
|
|
2236
|
+
// Flatten if result is array of arrays
|
|
2237
|
+
if (isArray(formattedData[0])) {
|
|
2238
|
+
formattedData = flatten(formattedData);
|
|
2239
|
+
}
|
|
2240
|
+
listenerFn(formattedData, oldVal);
|
|
2209
2241
|
};
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2242
|
+
/**
|
|
2243
|
+
* Updates watch info for array expressions
|
|
2244
|
+
*/
|
|
2245
|
+
const getUpdatedWatchInfo = (expr, acceptsArray, listener) => {
|
|
2246
|
+
const regex = /\[\$i\]/g;
|
|
2214
2247
|
if (!acceptsArray) {
|
|
2215
2248
|
return {
|
|
2216
|
-
|
|
2217
|
-
|
|
2249
|
+
expr: expr.replace(regex, ARRAY_INDEX_ZERO),
|
|
2250
|
+
listener
|
|
2218
2251
|
};
|
|
2219
2252
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2253
|
+
const lastIndex = expr.lastIndexOf(ARRAY_INDEX_PLACEHOLDER);
|
|
2254
|
+
const baseExpr = expr.substring(0, lastIndex).replace(ARRAY_INDEX_PLACEHOLDER, ARRAY_INDEX_ZERO);
|
|
2255
|
+
const restExpr = expr.substring(lastIndex + ARRAY_INDEX_PLACEHOLDER.length);
|
|
2256
|
+
const arrayConsumerFn = restExpr
|
|
2257
|
+
? arrayConsumer.bind(undefined, listener, restExpr)
|
|
2258
|
+
: listener;
|
|
2226
2259
|
return {
|
|
2227
|
-
|
|
2228
|
-
|
|
2260
|
+
expr: baseExpr,
|
|
2261
|
+
listener: arrayConsumerFn
|
|
2229
2262
|
};
|
|
2230
2263
|
};
|
|
2264
|
+
/**
|
|
2265
|
+
* Determines if an expression is static (doesn't need to be watched)
|
|
2266
|
+
*/
|
|
2267
|
+
const STATIC_EXPRESSION_NAMES = [
|
|
2268
|
+
"row.getProperty('investment')",
|
|
2269
|
+
"row.getProperty('factsheetLink')",
|
|
2270
|
+
"row.getProperty('isRebalanceEligible')"
|
|
2271
|
+
];
|
|
2272
|
+
const isStaticExpression = (expr) => {
|
|
2273
|
+
if (typeof expr !== 'string') {
|
|
2274
|
+
return false;
|
|
2275
|
+
}
|
|
2276
|
+
const trimmedExpr = expr.trim();
|
|
2277
|
+
// Expressions that always evaluate to localization strings
|
|
2278
|
+
if (trimmedExpr.includes('appLocale')) {
|
|
2279
|
+
return true;
|
|
2280
|
+
}
|
|
2281
|
+
// Hard-coded static expression names
|
|
2282
|
+
if (STATIC_EXPRESSION_NAMES.includes(trimmedExpr)) {
|
|
2283
|
+
return true;
|
|
2284
|
+
}
|
|
2285
|
+
return false;
|
|
2286
|
+
};
|
|
2287
|
+
/**
|
|
2288
|
+
* Gets the scope type from the scope object
|
|
2289
|
+
*/
|
|
2290
|
+
const getScopeType = ($scope) => {
|
|
2291
|
+
if (!$scope) {
|
|
2292
|
+
return null;
|
|
2293
|
+
}
|
|
2294
|
+
if ($scope.pageName)
|
|
2295
|
+
return 'Page';
|
|
2296
|
+
if ($scope.prefabName)
|
|
2297
|
+
return 'Prefab';
|
|
2298
|
+
if ($scope.partialName)
|
|
2299
|
+
return 'Partial';
|
|
2300
|
+
// Check for App scope
|
|
2301
|
+
if ($scope.Variables !== undefined &&
|
|
2302
|
+
$scope.Actions !== undefined &&
|
|
2303
|
+
!$scope.pageName &&
|
|
2304
|
+
!$scope.prefabName &&
|
|
2305
|
+
!$scope.partialName) {
|
|
2306
|
+
return 'App';
|
|
2307
|
+
}
|
|
2308
|
+
if ($scope.constructor?.name === 'AppRef') {
|
|
2309
|
+
return 'App';
|
|
2310
|
+
}
|
|
2311
|
+
return null;
|
|
2312
|
+
};
|
|
2313
|
+
/**
|
|
2314
|
+
* Gets scope name based on scope type
|
|
2315
|
+
*/
|
|
2316
|
+
const getScopeName = ($scope, scopeType) => {
|
|
2317
|
+
if (!scopeType || !$scope) {
|
|
2318
|
+
return null;
|
|
2319
|
+
}
|
|
2320
|
+
switch (scopeType) {
|
|
2321
|
+
case 'Prefab': return $scope.prefabName || null;
|
|
2322
|
+
case 'Partial': return $scope.partialName || null;
|
|
2323
|
+
case 'Page': return $scope.pageName || null;
|
|
2324
|
+
default: return null;
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
* Main watch function
|
|
2329
|
+
*/
|
|
2231
2330
|
const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.nextUid(), doNotClone = false, config = {}, isMuted) => {
|
|
2232
|
-
|
|
2233
|
-
|
|
2331
|
+
// Handle array expressions
|
|
2332
|
+
if (expr.includes(ARRAY_INDEX_PLACEHOLDER)) {
|
|
2333
|
+
const watchInfo = getUpdatedWatchInfo(expr, config.arrayType || config.isList || false, listener);
|
|
2234
2334
|
expr = watchInfo.expr;
|
|
2235
2335
|
listener = watchInfo.listener;
|
|
2236
2336
|
}
|
|
2337
|
+
// Handle static expressions
|
|
2338
|
+
if (isStaticExpression(expr)) {
|
|
2339
|
+
try {
|
|
2340
|
+
const fn = $parseExpr(expr);
|
|
2341
|
+
const staticValue = fn($scope, $locals);
|
|
2342
|
+
listener(staticValue, FIRST_TIME_WATCH);
|
|
2343
|
+
}
|
|
2344
|
+
catch (e) {
|
|
2345
|
+
console.warn(`Error evaluating static expression '${expr}':`, e);
|
|
2346
|
+
listener(undefined, FIRST_TIME_WATCH);
|
|
2347
|
+
}
|
|
2348
|
+
return () => { }; // No-op unsubscribe
|
|
2349
|
+
}
|
|
2237
2350
|
const fn = $parseExpr(expr);
|
|
2238
|
-
|
|
2239
|
-
|
|
2351
|
+
const scopeType = getScopeType($scope);
|
|
2352
|
+
const scopeName = getScopeName($scope, scopeType);
|
|
2353
|
+
const watchInfo = {
|
|
2354
|
+
fn: fn.bind(null, $scope, $locals),
|
|
2240
2355
|
listener,
|
|
2241
2356
|
expr,
|
|
2242
2357
|
last: FIRST_TIME_WATCH,
|
|
2243
2358
|
doNotClone,
|
|
2244
|
-
isMuted
|
|
2245
|
-
|
|
2359
|
+
isMuted,
|
|
2360
|
+
scopeType,
|
|
2361
|
+
scopeName
|
|
2362
|
+
};
|
|
2363
|
+
// Store in registry
|
|
2364
|
+
const widgetId = getWidgetId(identifier);
|
|
2365
|
+
if (widgetId) {
|
|
2366
|
+
const propertyName = getPropertyName(identifier);
|
|
2367
|
+
if (!registry.has(widgetId)) {
|
|
2368
|
+
registry.set(widgetId, {});
|
|
2369
|
+
}
|
|
2370
|
+
const widgetGroup = registry.get(widgetId);
|
|
2371
|
+
widgetGroup[propertyName] = watchInfo;
|
|
2372
|
+
}
|
|
2373
|
+
else {
|
|
2374
|
+
registry.set(identifier, watchInfo);
|
|
2375
|
+
}
|
|
2246
2376
|
return () => $unwatch(identifier);
|
|
2247
2377
|
};
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
const
|
|
2378
|
+
/**
|
|
2379
|
+
* Unwatches a single identifier
|
|
2380
|
+
*/
|
|
2381
|
+
const $unwatch = (identifier) => {
|
|
2382
|
+
const widgetId = getWidgetId(identifier);
|
|
2383
|
+
if (widgetId) {
|
|
2384
|
+
const propertyName = getPropertyName(identifier);
|
|
2385
|
+
const widgetGroup = registry.get(widgetId);
|
|
2386
|
+
if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
|
|
2387
|
+
const watchInfo = widgetGroup[propertyName];
|
|
2388
|
+
if (watchInfo) {
|
|
2389
|
+
delete widgetGroup[propertyName];
|
|
2390
|
+
// Clean up empty widget groups
|
|
2391
|
+
if (Object.keys(widgetGroup).length === 0) {
|
|
2392
|
+
registry.delete(widgetId);
|
|
2393
|
+
}
|
|
2394
|
+
return true;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
// Fallback to direct lookup
|
|
2399
|
+
if (registry.has(identifier)) {
|
|
2400
|
+
registry.delete(identifier);
|
|
2401
|
+
return true;
|
|
2402
|
+
}
|
|
2403
|
+
return false;
|
|
2404
|
+
};
|
|
2405
|
+
/**
|
|
2406
|
+
* Unwatches all watchers for a specific widget ID
|
|
2407
|
+
*/
|
|
2408
|
+
const $unwatchAll = (widgetId) => {
|
|
2409
|
+
if (!widgetId || typeof widgetId !== 'string') {
|
|
2410
|
+
return 0;
|
|
2411
|
+
}
|
|
2412
|
+
const widgetGroup = registry.get(widgetId);
|
|
2413
|
+
if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
|
|
2414
|
+
const count = Object.keys(widgetGroup).length;
|
|
2415
|
+
registry.delete(widgetId);
|
|
2416
|
+
return count;
|
|
2417
|
+
}
|
|
2418
|
+
// Fallback: find all identifiers starting with this widget ID
|
|
2419
|
+
let removedCount = 0;
|
|
2420
|
+
const identifiersToRemove = [];
|
|
2421
|
+
registry.forEach((_, key) => {
|
|
2422
|
+
if (key.startsWith(widgetId + '_')) {
|
|
2423
|
+
identifiersToRemove.push(key);
|
|
2424
|
+
}
|
|
2425
|
+
});
|
|
2426
|
+
identifiersToRemove.forEach(identifier => {
|
|
2427
|
+
if ($unwatch(identifier)) {
|
|
2428
|
+
removedCount++;
|
|
2429
|
+
}
|
|
2430
|
+
});
|
|
2431
|
+
return removedCount;
|
|
2432
|
+
};
|
|
2433
|
+
/**
|
|
2434
|
+
* Unwatches all watchers for a specific scope (Page, Prefab, Partial, or App)
|
|
2435
|
+
* Now works directly with the main registry instead of separate scoped registries
|
|
2436
|
+
*/
|
|
2437
|
+
const $unwatchAllByScope = (scopeType, scopeName) => {
|
|
2438
|
+
if (!scopeType) {
|
|
2439
|
+
return 0;
|
|
2440
|
+
}
|
|
2441
|
+
let removedCount = 0;
|
|
2442
|
+
const identifiersToRemove = [];
|
|
2443
|
+
registry.forEach((value, key) => {
|
|
2444
|
+
// Handle grouped structure (widget groups)
|
|
2445
|
+
if (value && typeof value === 'object' && !value.fn) {
|
|
2446
|
+
Object.entries(value).forEach(([propertyName, watchInfo]) => {
|
|
2447
|
+
if (watchInfo?.scopeType === scopeType &&
|
|
2448
|
+
(!scopeName || watchInfo.scopeName === scopeName)) {
|
|
2449
|
+
identifiersToRemove.push(`${key}_${propertyName}`);
|
|
2450
|
+
}
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
// Direct watchInfo
|
|
2455
|
+
const watchInfo = value;
|
|
2456
|
+
if (watchInfo?.scopeType === scopeType &&
|
|
2457
|
+
(!scopeName || watchInfo.scopeName === scopeName)) {
|
|
2458
|
+
identifiersToRemove.push(key);
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
// Unwatch all collected identifiers
|
|
2463
|
+
identifiersToRemove.forEach(identifier => {
|
|
2464
|
+
if ($unwatch(identifier)) {
|
|
2465
|
+
removedCount++;
|
|
2466
|
+
}
|
|
2467
|
+
});
|
|
2468
|
+
return removedCount;
|
|
2469
|
+
};
|
|
2470
|
+
/**
|
|
2471
|
+
* Processes a single watch info during trigger cycle
|
|
2472
|
+
*/
|
|
2473
|
+
const processWatchInfo = (watchInfo) => {
|
|
2474
|
+
if (!watchInfo?.fn || (watchInfo.isMuted?.() ?? false)) {
|
|
2475
|
+
return false;
|
|
2476
|
+
}
|
|
2477
|
+
let newValue;
|
|
2478
|
+
try {
|
|
2479
|
+
newValue = watchInfo.fn();
|
|
2480
|
+
}
|
|
2481
|
+
catch (e) {
|
|
2482
|
+
console.warn(`Error executing expression: '${watchInfo.expr}'`, e);
|
|
2483
|
+
return false;
|
|
2484
|
+
}
|
|
2485
|
+
if (isEqual(newValue, watchInfo.last)) {
|
|
2486
|
+
return false;
|
|
2487
|
+
}
|
|
2488
|
+
// Change detected
|
|
2489
|
+
changedByWatch = true;
|
|
2490
|
+
watchInfo.last = isObject$1(newValue) && !watchInfo.doNotClone
|
|
2491
|
+
? clone(newValue)
|
|
2492
|
+
: newValue;
|
|
2493
|
+
watchInfo.listener(newValue, watchInfo.last === newValue ? FIRST_TIME_WATCH : watchInfo.last);
|
|
2494
|
+
changedByWatch = false;
|
|
2495
|
+
return true;
|
|
2496
|
+
};
|
|
2497
|
+
/**
|
|
2498
|
+
* Triggers all watchers
|
|
2499
|
+
*/
|
|
2500
|
+
const triggerWatchers = (ignoreMuted = false) => {
|
|
2253
2501
|
if (muted && !ignoreMuted) {
|
|
2254
2502
|
return;
|
|
2255
2503
|
}
|
|
2256
|
-
const limit = 5;
|
|
2257
2504
|
let pass = 1;
|
|
2258
2505
|
let changeDetected;
|
|
2259
2506
|
do {
|
|
2260
2507
|
changeDetected = false;
|
|
2261
|
-
registry.forEach(
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
try {
|
|
2270
|
-
nv = fn();
|
|
2271
|
-
}
|
|
2272
|
-
catch (e) {
|
|
2273
|
-
console.warn(`error in executing expression: '${watchInfo.expr}'`);
|
|
2508
|
+
registry.forEach((value) => {
|
|
2509
|
+
// Handle grouped structure
|
|
2510
|
+
if (value && typeof value === 'object' && !value.fn) {
|
|
2511
|
+
Object.values(value).forEach((watchInfo) => {
|
|
2512
|
+
if (processWatchInfo(watchInfo)) {
|
|
2513
|
+
changeDetected = true;
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2274
2516
|
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
// @ts-ignore
|
|
2280
|
-
if (isObject$1(nv) && !watchInfo.doNotClone && nv.__cloneable__ !== false) {
|
|
2281
|
-
watchInfo.last = clone(nv);
|
|
2517
|
+
else {
|
|
2518
|
+
// Direct watchInfo
|
|
2519
|
+
if (processWatchInfo(value)) {
|
|
2520
|
+
changeDetected = true;
|
|
2282
2521
|
}
|
|
2283
|
-
listener(nv, ov);
|
|
2284
|
-
resetChangeFromWatch();
|
|
2285
2522
|
}
|
|
2286
2523
|
});
|
|
2287
2524
|
pass++;
|
|
2288
|
-
} while (changeDetected && pass <
|
|
2289
|
-
if (changeDetected && pass ===
|
|
2290
|
-
console.warn(`
|
|
2525
|
+
} while (changeDetected && pass < MAX_WATCH_CYCLES);
|
|
2526
|
+
if (changeDetected && pass === MAX_WATCH_CYCLES) {
|
|
2527
|
+
console.warn(`Watch cycles exceeded limit of ${MAX_WATCH_CYCLES}`);
|
|
2291
2528
|
}
|
|
2292
2529
|
};
|
|
2293
|
-
|
|
2294
|
-
const
|
|
2530
|
+
// Angular zone integration
|
|
2531
|
+
const setNgZone = (zone) => {
|
|
2532
|
+
ngZone = zone;
|
|
2533
|
+
};
|
|
2534
|
+
const setAppRef = (ref) => {
|
|
2295
2535
|
appRef = ref;
|
|
2296
2536
|
};
|
|
2297
2537
|
const isChangeFromWatch = () => changedByWatch;
|
|
2298
|
-
const resetChangeFromWatch = () =>
|
|
2299
|
-
|
|
2300
|
-
|
|
2538
|
+
const resetChangeFromWatch = () => {
|
|
2539
|
+
changedByWatch = false;
|
|
2540
|
+
};
|
|
2541
|
+
// Debounced trigger
|
|
2301
2542
|
const debouncedTriggerWatchers = debounce(() => {
|
|
2302
2543
|
skipWatchers = true;
|
|
2303
2544
|
ngZone.run(() => triggerWatchers());
|
|
2304
|
-
},
|
|
2305
|
-
const $invokeWatchers = (force, ignoreMuted) => {
|
|
2545
|
+
}, DEBOUNCE_WAIT);
|
|
2546
|
+
const $invokeWatchers = (force = false, ignoreMuted = false) => {
|
|
2306
2547
|
if (force) {
|
|
2307
2548
|
triggerWatchers(ignoreMuted);
|
|
2308
2549
|
}
|
|
@@ -2316,7 +2557,8 @@ const $invokeWatchers = (force, ignoreMuted) => {
|
|
|
2316
2557
|
};
|
|
2317
2558
|
const $appDigest = (() => {
|
|
2318
2559
|
let queued = false;
|
|
2319
|
-
|
|
2560
|
+
const $RAF = window.requestAnimationFrame;
|
|
2561
|
+
return (force = false) => {
|
|
2320
2562
|
if (!appRef) {
|
|
2321
2563
|
return;
|
|
2322
2564
|
}
|
|
@@ -2328,16 +2570,16 @@ const $appDigest = (() => {
|
|
|
2328
2570
|
if (queued) {
|
|
2329
2571
|
return;
|
|
2330
2572
|
}
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
});
|
|
2337
|
-
}
|
|
2573
|
+
queued = true;
|
|
2574
|
+
$RAF(() => {
|
|
2575
|
+
ngZone.run(() => appRef.tick());
|
|
2576
|
+
queued = false;
|
|
2577
|
+
});
|
|
2338
2578
|
}
|
|
2339
2579
|
};
|
|
2340
2580
|
})();
|
|
2581
|
+
// Export registry for debugging
|
|
2582
|
+
// (window as any).watchRegistry = registry;
|
|
2341
2583
|
|
|
2342
2584
|
var ComponentType;
|
|
2343
2585
|
(function (ComponentType) {
|
|
@@ -2440,6 +2682,7 @@ const REGEX = {
|
|
|
2440
2682
|
MIN_PAGE_RESOURCE_PATH: /.*(page.min.html)$/,
|
|
2441
2683
|
VALID_EMAIL: /^[a-zA-Z][\w.+]+@[a-zA-Z_]+?\.[a-zA-Z.]{1,4}[a-zA-Z]$/,
|
|
2442
2684
|
VALID_WEB_URL: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9=:?\/\.\-]+(\.[a-zA-Z]{2,5}[\.]{0,1})?/,
|
|
2685
|
+
VALID_IMAGE_URL: /^(https?|blob|data|file|ftp):/i,
|
|
2443
2686
|
VALID_WEBSOCKET_URL: /^(ws[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9=:?\/\.\-]+(\.[a-zA-Z]{2,5}[\.]{0,1})?/,
|
|
2444
2687
|
VALID_RELATIVE_URL: /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,
|
|
2445
2688
|
REPLACE_PATTERN: /\$\{([^\}]+)\}/g,
|
|
@@ -2673,6 +2916,9 @@ const isVideoFile = (fileName) => {
|
|
|
2673
2916
|
const isValidWebURL = (url) => {
|
|
2674
2917
|
return (REGEX.VALID_WEB_URL).test(url);
|
|
2675
2918
|
};
|
|
2919
|
+
const isValidImageUrl = (url) => {
|
|
2920
|
+
return (REGEX.VALID_IMAGE_URL).test(url?.trim());
|
|
2921
|
+
};
|
|
2676
2922
|
/*This function returns the url to the resource after checking the validity of url*/
|
|
2677
2923
|
const getResourceURL = (urlString) => {
|
|
2678
2924
|
if (isValidWebURL(urlString)) {
|
|
@@ -3938,6 +4184,7 @@ var Utils = /*#__PURE__*/Object.freeze({
|
|
|
3938
4184
|
isPageable: isPageable,
|
|
3939
4185
|
isSafari: isSafari,
|
|
3940
4186
|
isTablet: isTablet,
|
|
4187
|
+
isValidImageUrl: isValidImageUrl,
|
|
3941
4188
|
isValidWebURL: isValidWebURL,
|
|
3942
4189
|
isVideoFile: isVideoFile,
|
|
3943
4190
|
loadScript: loadScript,
|
|
@@ -5177,5 +5424,5 @@ class LRUCache {
|
|
|
5177
5424
|
* Generated bundle index. Do not edit.
|
|
5178
5425
|
*/
|
|
5179
5426
|
|
|
5180
|
-
export { $appDigest, $invokeWatchers, $parseEvent, $parseExpr, $unwatch, $watch, AbstractDialogService, AbstractHttpService, AbstractI18nService, AbstractNavigationService, AbstractSpinnerService, AbstractToasterService, App, AppConstants, AppDefaults, CURRENCY_INFO, ComponentType, ConstantService, CustomIconsLoaderService, CustomPipeManager, CustomWidgetRefProvider, DEFAULT_FORMATS, DataSource, DataType, DynamicComponentRefProvider, EventNotifier, FIRST_TIME_WATCH, FieldTypeService, FieldWidgetService, FormWidgetType, IDGenerator, IDataSource, LRUCache, MatchMode, PaginationService, PartialRefProvider, ScriptLoaderService, ScriptStore, StatePersistence, UserDefinedExecutionContext, UtilsService, VALIDATOR, Viewport, _WM_APP_PROJECT, addClass, addEventListenerOnElement, addForIdAttributes, adjustContainerPosition, adjustContainerRightEdges, appendNode, appendScriptToHead, checkIsCustomPipeExpression, closePopover, convertToBlob, createCSSRule, createElement, deHyphenate, debounce, defer, detectChanges, encodeUrl, encodeUrlParams, executePromiseChain, extendProto, extractCurrentItemExpr, extractType, fetchContent, findParent, findRootContainer, findValueOf, generateGUId, getAbortableDefer, getAndroidVersion, getAppSetting, getBlob, getClonedObject, getDatasourceFromExpr, getDateObj, getDisplayDateTimeFormat, getEvaluatedExprValue, getFiles, getFnByExpr, getFnForBindExpr, getFnForEventExpr, getFormWidgetTemplate, getFormattedDate, getMomentLocaleObject, getNativeDateObject, getNavClass, getNgModelAttr, getPreviewProperties, getRequiredFormWidget, getResourceURL, getRouteNameFromLink, getRowActionAttrs, getSessionStorageItem, getSheetPositionClass, getUrlParams, getValidDateObject, getValidJSON, getWebkitTraslationMatrix, getWmProjectProperties, hasOffsetStr, initCaps, insertAfter, insertBefore, isAndroid, isAndroidTablet, isAppleProduct, isAudioFile, isChangeFromWatch, isDataSourceEqual, isDateTimeType, isDefined, isElementInViewport, isEmptyObject, isEqualWithFields, isFirstTimeChange, isIE, isImageFile, isInsecureContentRequest, isIos, isIpad, isIphone, isIpod, isKitkatDevice, isLargeTabletLandscape, isLargeTabletPortrait, isMobile, isNumberType, isObject, isPageable, isSafari, isValidWebURL, isVideoFile, loadScript, loadScripts, loadStyleSheet, loadStyleSheets, muteWatchers, noop, openLink, periodSeparate, prettifyLabel, prettifyLabels, processFilterExpBindNode, registerFnByExpr, removeAttr, removeClass, removeExtraSlashes, removeNode, replace, replaceAt, resetChangeFromWatch, retryIfFails, scrollToElement, setAppRef, setAttr, setCSS, setCSSFromObj, setHtml, setListClass, setNgZone, setPipeProvider, setPreviewProperties, setProperty, setSessionStorageItem, setTranslation3dPosition, setWmProjectProperties, spaceSeparate, stringStartsWith, switchClass, toBoolean, toDimension, toPromise, toggleClass, transformFileURI, triggerFn, triggerItemAction, unMuteWatchers, updateTemplateAttrs, validateAccessRoles, validateDataSourceCtx, xmlToJson };
|
|
5427
|
+
export { $appDigest, $invokeWatchers, $parseEvent, $parseExpr, $unwatch, $unwatchAll, $unwatchAllByScope, $watch, AbstractDialogService, AbstractHttpService, AbstractI18nService, AbstractNavigationService, AbstractSpinnerService, AbstractToasterService, App, AppConstants, AppDefaults, CURRENCY_INFO, ComponentType, ConstantService, CustomIconsLoaderService, CustomPipeManager, CustomWidgetRefProvider, DEFAULT_FORMATS, DataSource, DataType, DynamicComponentRefProvider, EventNotifier, FIRST_TIME_WATCH, FieldTypeService, FieldWidgetService, FormWidgetType, IDGenerator, IDataSource, LRUCache, MatchMode, PaginationService, PartialRefProvider, ScriptLoaderService, ScriptStore, StatePersistence, UserDefinedExecutionContext, UtilsService, VALIDATOR, Viewport, _WM_APP_PROJECT, addClass, addEventListenerOnElement, addForIdAttributes, adjustContainerPosition, adjustContainerRightEdges, appendNode, appendScriptToHead, checkIsCustomPipeExpression, closePopover, convertToBlob, createCSSRule, createElement, deHyphenate, debounce, defer, detectChanges, encodeUrl, encodeUrlParams, executePromiseChain, extendProto, extractCurrentItemExpr, extractType, fetchContent, findParent, findRootContainer, findValueOf, generateGUId, getAbortableDefer, getAndroidVersion, getAppSetting, getBlob, getClonedObject, getDatasourceFromExpr, getDateObj, getDisplayDateTimeFormat, getEvaluatedExprValue, getFiles, getFnByExpr, getFnForBindExpr, getFnForEventExpr, getFormWidgetTemplate, getFormattedDate, getMomentLocaleObject, getNativeDateObject, getNavClass, getNgModelAttr, getPreviewProperties, getRequiredFormWidget, getResourceURL, getRouteNameFromLink, getRowActionAttrs, getSessionStorageItem, getSheetPositionClass, getUrlParams, getValidDateObject, getValidJSON, getWebkitTraslationMatrix, getWmProjectProperties, hasOffsetStr, initCaps, insertAfter, insertBefore, isAndroid, isAndroidTablet, isAppleProduct, isAudioFile, isChangeFromWatch, isDataSourceEqual, isDateTimeType, isDefined, isElementInViewport, isEmptyObject, isEqualWithFields, isFirstTimeChange, isIE, isImageFile, isInsecureContentRequest, isIos, isIpad, isIphone, isIpod, isKitkatDevice, isLargeTabletLandscape, isLargeTabletPortrait, isMobile, isNumberType, isObject, isPageable, isSafari, isValidImageUrl, isValidWebURL, isVideoFile, loadScript, loadScripts, loadStyleSheet, loadStyleSheets, muteWatchers, noop, openLink, periodSeparate, prettifyLabel, prettifyLabels, processFilterExpBindNode, registerFnByExpr, removeAttr, removeClass, removeExtraSlashes, removeNode, replace, replaceAt, resetChangeFromWatch, retryIfFails, scrollToElement, setAppRef, setAttr, setCSS, setCSSFromObj, setHtml, setListClass, setNgZone, setPipeProvider, setPreviewProperties, setProperty, setSessionStorageItem, setTranslation3dPosition, setWmProjectProperties, spaceSeparate, stringStartsWith, switchClass, toBoolean, toDimension, toPromise, toggleClass, transformFileURI, triggerFn, triggerItemAction, unMuteWatchers, updateTemplateAttrs, validateAccessRoles, validateDataSourceCtx, xmlToJson };
|
|
5181
5428
|
//# sourceMappingURL=index.mjs.map
|