@almadar/ui 5.17.1 → 5.18.0
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/avl/index.cjs +38 -18
- package/dist/avl/index.js +38 -18
- package/dist/components/index.cjs +7 -3
- package/dist/components/index.js +7 -3
- package/dist/providers/index.cjs +7 -3
- package/dist/providers/index.js +7 -3
- package/dist/runtime/fn-form-lambda.d.ts +1 -1
- package/dist/runtime/index.cjs +38 -18
- package/dist/runtime/index.js +38 -18
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -56590,11 +56590,15 @@ function SlotContentRenderer({
|
|
|
56590
56590
|
}
|
|
56591
56591
|
if (propsSchema) {
|
|
56592
56592
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
56593
|
-
const
|
|
56594
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
56593
|
+
const isDate = propDef.types?.some(
|
|
56595
56594
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
56596
|
-
)
|
|
56595
|
+
);
|
|
56596
|
+
if (!isDate) continue;
|
|
56597
|
+
const v = renderedProps[propKey];
|
|
56598
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
56597
56599
|
renderedProps[propKey] = new Date(v);
|
|
56600
|
+
} else if (v == null && propDef.required) {
|
|
56601
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
56598
56602
|
}
|
|
56599
56603
|
}
|
|
56600
56604
|
}
|
|
@@ -60286,12 +60290,26 @@ function collectEmbeddedTraits(schema) {
|
|
|
60286
60290
|
}
|
|
60287
60291
|
var lambdaLog = logger.createLogger("almadar:ui:fn-form-lambda");
|
|
60288
60292
|
function isFnFormLambda(value) {
|
|
60289
|
-
|
|
60293
|
+
if (!Array.isArray(value)) return false;
|
|
60294
|
+
const arr = value;
|
|
60295
|
+
if (arr.length !== 3 || arr[0] !== "fn" || arr[2] === null || typeof arr[2] !== "object") {
|
|
60296
|
+
return false;
|
|
60297
|
+
}
|
|
60298
|
+
const params = arr[1];
|
|
60299
|
+
return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p2) => typeof p2 === "string");
|
|
60300
|
+
}
|
|
60301
|
+
function fnFormParams(value) {
|
|
60302
|
+
const p2 = value[1];
|
|
60303
|
+
if (typeof p2 === "string") return [p2];
|
|
60304
|
+
if (Array.isArray(p2)) return p2.filter((x) => typeof x === "string");
|
|
60305
|
+
return [];
|
|
60290
60306
|
}
|
|
60291
|
-
function resolveLambdaBindings(body,
|
|
60292
|
-
const
|
|
60307
|
+
function resolveLambdaBindings(body, params, item, index) {
|
|
60308
|
+
const itemName = params[0];
|
|
60309
|
+
const indexName = params[1];
|
|
60310
|
+
const itemPrefix = itemName ? `@${itemName}.` : null;
|
|
60293
60311
|
const lookup = (path) => {
|
|
60294
|
-
let cur =
|
|
60312
|
+
let cur = item;
|
|
60295
60313
|
for (const seg of path.split(".")) {
|
|
60296
60314
|
if (cur === null || cur === void 0) return void 0;
|
|
60297
60315
|
if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
@@ -60299,21 +60317,23 @@ function resolveLambdaBindings(body, argName, arg) {
|
|
|
60299
60317
|
}
|
|
60300
60318
|
return cur;
|
|
60301
60319
|
};
|
|
60320
|
+
const recur = (b) => resolveLambdaBindings(b, params, item, index);
|
|
60302
60321
|
if (typeof body === "string") {
|
|
60303
|
-
if (body === `@${
|
|
60304
|
-
if (body
|
|
60305
|
-
|
|
60322
|
+
if (indexName && body === `@${indexName}`) return index;
|
|
60323
|
+
if (itemName && body === `@${itemName}`) return item;
|
|
60324
|
+
if (itemPrefix && body.startsWith(itemPrefix)) {
|
|
60325
|
+
const v = lookup(body.slice(itemPrefix.length));
|
|
60306
60326
|
return v === void 0 || v === null ? "" : v;
|
|
60307
60327
|
}
|
|
60308
60328
|
return body;
|
|
60309
60329
|
}
|
|
60310
60330
|
if (Array.isArray(body)) {
|
|
60311
|
-
return body.map((b) =>
|
|
60331
|
+
return body.map((b) => recur(b));
|
|
60312
60332
|
}
|
|
60313
60333
|
if (body !== null && typeof body === "object" && !React98__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
60314
60334
|
const out = {};
|
|
60315
60335
|
for (const [k, v] of Object.entries(body)) {
|
|
60316
|
-
out[k] =
|
|
60336
|
+
out[k] = recur(v);
|
|
60317
60337
|
}
|
|
60318
60338
|
return out;
|
|
60319
60339
|
}
|
|
@@ -60326,9 +60346,9 @@ function getSlotContentRenderer2() {
|
|
|
60326
60346
|
_slotContentRenderer2 = mod.SlotContentRenderer;
|
|
60327
60347
|
return _slotContentRenderer2;
|
|
60328
60348
|
}
|
|
60329
|
-
function makeLambdaFn(
|
|
60349
|
+
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
60330
60350
|
return (item, index) => {
|
|
60331
|
-
const resolvedBody = resolveLambdaBindings(lambdaBody,
|
|
60351
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
60332
60352
|
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React98__namespace.default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
60333
60353
|
return null;
|
|
60334
60354
|
}
|
|
@@ -60355,8 +60375,8 @@ function convertNode(node, callerKey) {
|
|
|
60355
60375
|
if (node === null || node === void 0) return node;
|
|
60356
60376
|
if (Array.isArray(node)) {
|
|
60357
60377
|
if (isFnFormLambda(node)) {
|
|
60358
|
-
const
|
|
60359
|
-
return makeLambdaFn(
|
|
60378
|
+
const arr2 = node;
|
|
60379
|
+
return makeLambdaFn(fnFormParams(arr2), arr2[2], callerKey);
|
|
60360
60380
|
}
|
|
60361
60381
|
const arr = node;
|
|
60362
60382
|
let anyChanged = false;
|
|
@@ -60378,9 +60398,9 @@ function convertObjectProps(props) {
|
|
|
60378
60398
|
for (const [key, value] of Object.entries(props)) {
|
|
60379
60399
|
if (isFnFormLambda(value)) {
|
|
60380
60400
|
convertedAny = true;
|
|
60381
|
-
const
|
|
60401
|
+
const arr = value;
|
|
60382
60402
|
const targetKey = key === "renderItem" ? "children" : key;
|
|
60383
|
-
out[targetKey] = makeLambdaFn(
|
|
60403
|
+
out[targetKey] = makeLambdaFn(fnFormParams(arr), arr[2], key);
|
|
60384
60404
|
lambdaLog.debug(`convert key=${key} \u2192 ${targetKey}`);
|
|
60385
60405
|
continue;
|
|
60386
60406
|
}
|
package/dist/avl/index.js
CHANGED
|
@@ -56541,11 +56541,15 @@ function SlotContentRenderer({
|
|
|
56541
56541
|
}
|
|
56542
56542
|
if (propsSchema) {
|
|
56543
56543
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
56544
|
-
const
|
|
56545
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
56544
|
+
const isDate = propDef.types?.some(
|
|
56546
56545
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
56547
|
-
)
|
|
56546
|
+
);
|
|
56547
|
+
if (!isDate) continue;
|
|
56548
|
+
const v = renderedProps[propKey];
|
|
56549
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
56548
56550
|
renderedProps[propKey] = new Date(v);
|
|
56551
|
+
} else if (v == null && propDef.required) {
|
|
56552
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
56549
56553
|
}
|
|
56550
56554
|
}
|
|
56551
56555
|
}
|
|
@@ -60237,12 +60241,26 @@ function collectEmbeddedTraits(schema) {
|
|
|
60237
60241
|
}
|
|
60238
60242
|
var lambdaLog = createLogger("almadar:ui:fn-form-lambda");
|
|
60239
60243
|
function isFnFormLambda(value) {
|
|
60240
|
-
|
|
60244
|
+
if (!Array.isArray(value)) return false;
|
|
60245
|
+
const arr = value;
|
|
60246
|
+
if (arr.length !== 3 || arr[0] !== "fn" || arr[2] === null || typeof arr[2] !== "object") {
|
|
60247
|
+
return false;
|
|
60248
|
+
}
|
|
60249
|
+
const params = arr[1];
|
|
60250
|
+
return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p2) => typeof p2 === "string");
|
|
60251
|
+
}
|
|
60252
|
+
function fnFormParams(value) {
|
|
60253
|
+
const p2 = value[1];
|
|
60254
|
+
if (typeof p2 === "string") return [p2];
|
|
60255
|
+
if (Array.isArray(p2)) return p2.filter((x) => typeof x === "string");
|
|
60256
|
+
return [];
|
|
60241
60257
|
}
|
|
60242
|
-
function resolveLambdaBindings(body,
|
|
60243
|
-
const
|
|
60258
|
+
function resolveLambdaBindings(body, params, item, index) {
|
|
60259
|
+
const itemName = params[0];
|
|
60260
|
+
const indexName = params[1];
|
|
60261
|
+
const itemPrefix = itemName ? `@${itemName}.` : null;
|
|
60244
60262
|
const lookup = (path) => {
|
|
60245
|
-
let cur =
|
|
60263
|
+
let cur = item;
|
|
60246
60264
|
for (const seg of path.split(".")) {
|
|
60247
60265
|
if (cur === null || cur === void 0) return void 0;
|
|
60248
60266
|
if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
@@ -60250,21 +60268,23 @@ function resolveLambdaBindings(body, argName, arg) {
|
|
|
60250
60268
|
}
|
|
60251
60269
|
return cur;
|
|
60252
60270
|
};
|
|
60271
|
+
const recur = (b) => resolveLambdaBindings(b, params, item, index);
|
|
60253
60272
|
if (typeof body === "string") {
|
|
60254
|
-
if (body === `@${
|
|
60255
|
-
if (body
|
|
60256
|
-
|
|
60273
|
+
if (indexName && body === `@${indexName}`) return index;
|
|
60274
|
+
if (itemName && body === `@${itemName}`) return item;
|
|
60275
|
+
if (itemPrefix && body.startsWith(itemPrefix)) {
|
|
60276
|
+
const v = lookup(body.slice(itemPrefix.length));
|
|
60257
60277
|
return v === void 0 || v === null ? "" : v;
|
|
60258
60278
|
}
|
|
60259
60279
|
return body;
|
|
60260
60280
|
}
|
|
60261
60281
|
if (Array.isArray(body)) {
|
|
60262
|
-
return body.map((b) =>
|
|
60282
|
+
return body.map((b) => recur(b));
|
|
60263
60283
|
}
|
|
60264
60284
|
if (body !== null && typeof body === "object" && !React98__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
60265
60285
|
const out = {};
|
|
60266
60286
|
for (const [k, v] of Object.entries(body)) {
|
|
60267
|
-
out[k] =
|
|
60287
|
+
out[k] = recur(v);
|
|
60268
60288
|
}
|
|
60269
60289
|
return out;
|
|
60270
60290
|
}
|
|
@@ -60277,9 +60297,9 @@ function getSlotContentRenderer2() {
|
|
|
60277
60297
|
_slotContentRenderer2 = mod.SlotContentRenderer;
|
|
60278
60298
|
return _slotContentRenderer2;
|
|
60279
60299
|
}
|
|
60280
|
-
function makeLambdaFn(
|
|
60300
|
+
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
60281
60301
|
return (item, index) => {
|
|
60282
|
-
const resolvedBody = resolveLambdaBindings(lambdaBody,
|
|
60302
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
60283
60303
|
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React98__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
60284
60304
|
return null;
|
|
60285
60305
|
}
|
|
@@ -60306,8 +60326,8 @@ function convertNode(node, callerKey) {
|
|
|
60306
60326
|
if (node === null || node === void 0) return node;
|
|
60307
60327
|
if (Array.isArray(node)) {
|
|
60308
60328
|
if (isFnFormLambda(node)) {
|
|
60309
|
-
const
|
|
60310
|
-
return makeLambdaFn(
|
|
60329
|
+
const arr2 = node;
|
|
60330
|
+
return makeLambdaFn(fnFormParams(arr2), arr2[2], callerKey);
|
|
60311
60331
|
}
|
|
60312
60332
|
const arr = node;
|
|
60313
60333
|
let anyChanged = false;
|
|
@@ -60329,9 +60349,9 @@ function convertObjectProps(props) {
|
|
|
60329
60349
|
for (const [key, value] of Object.entries(props)) {
|
|
60330
60350
|
if (isFnFormLambda(value)) {
|
|
60331
60351
|
convertedAny = true;
|
|
60332
|
-
const
|
|
60352
|
+
const arr = value;
|
|
60333
60353
|
const targetKey = key === "renderItem" ? "children" : key;
|
|
60334
|
-
out[targetKey] = makeLambdaFn(
|
|
60354
|
+
out[targetKey] = makeLambdaFn(fnFormParams(arr), arr[2], key);
|
|
60335
60355
|
lambdaLog.debug(`convert key=${key} \u2192 ${targetKey}`);
|
|
60336
60356
|
continue;
|
|
60337
60357
|
}
|
|
@@ -47825,11 +47825,15 @@ function SlotContentRenderer({
|
|
|
47825
47825
|
}
|
|
47826
47826
|
if (propsSchema) {
|
|
47827
47827
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47828
|
-
const
|
|
47829
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47828
|
+
const isDate = propDef.types?.some(
|
|
47830
47829
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47831
|
-
)
|
|
47830
|
+
);
|
|
47831
|
+
if (!isDate) continue;
|
|
47832
|
+
const v = renderedProps[propKey];
|
|
47833
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47832
47834
|
renderedProps[propKey] = new Date(v);
|
|
47835
|
+
} else if (v == null && propDef.required) {
|
|
47836
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47833
47837
|
}
|
|
47834
47838
|
}
|
|
47835
47839
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -47776,11 +47776,15 @@ function SlotContentRenderer({
|
|
|
47776
47776
|
}
|
|
47777
47777
|
if (propsSchema) {
|
|
47778
47778
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47779
|
-
const
|
|
47780
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47779
|
+
const isDate = propDef.types?.some(
|
|
47781
47780
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47782
|
-
)
|
|
47781
|
+
);
|
|
47782
|
+
if (!isDate) continue;
|
|
47783
|
+
const v = renderedProps[propKey];
|
|
47784
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47783
47785
|
renderedProps[propKey] = new Date(v);
|
|
47786
|
+
} else if (v == null && propDef.required) {
|
|
47787
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47784
47788
|
}
|
|
47785
47789
|
}
|
|
47786
47790
|
}
|
package/dist/providers/index.cjs
CHANGED
|
@@ -47892,11 +47892,15 @@ function SlotContentRenderer({
|
|
|
47892
47892
|
}
|
|
47893
47893
|
if (propsSchema) {
|
|
47894
47894
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47895
|
-
const
|
|
47896
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47895
|
+
const isDate = propDef.types?.some(
|
|
47897
47896
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47898
|
-
)
|
|
47897
|
+
);
|
|
47898
|
+
if (!isDate) continue;
|
|
47899
|
+
const v = renderedProps[propKey];
|
|
47900
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47899
47901
|
renderedProps[propKey] = new Date(v);
|
|
47902
|
+
} else if (v == null && propDef.required) {
|
|
47903
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47900
47904
|
}
|
|
47901
47905
|
}
|
|
47902
47906
|
}
|
package/dist/providers/index.js
CHANGED
|
@@ -47843,11 +47843,15 @@ function SlotContentRenderer({
|
|
|
47843
47843
|
}
|
|
47844
47844
|
if (propsSchema) {
|
|
47845
47845
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47846
|
-
const
|
|
47847
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47846
|
+
const isDate = propDef.types?.some(
|
|
47848
47847
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47849
|
-
)
|
|
47848
|
+
);
|
|
47849
|
+
if (!isDate) continue;
|
|
47850
|
+
const v = renderedProps[propKey];
|
|
47851
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47850
47852
|
renderedProps[propKey] = new Date(v);
|
|
47853
|
+
} else if (v == null && propDef.required) {
|
|
47854
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47851
47855
|
}
|
|
47852
47856
|
}
|
|
47853
47857
|
}
|
|
@@ -17,7 +17,7 @@ export declare function isFnFormLambda(value: SlotPropValue): value is RenderIte
|
|
|
17
17
|
* value at `path` of `arg`. Mirrors the compiler's inline substitution
|
|
18
18
|
* for `renderItem` lambda bodies.
|
|
19
19
|
*/
|
|
20
|
-
export declare function resolveLambdaBindings(body: SlotPropValue,
|
|
20
|
+
export declare function resolveLambdaBindings(body: SlotPropValue, params: readonly string[], item: EntityRow, index: number): SlotPropValue;
|
|
21
21
|
/**
|
|
22
22
|
* Walk a pattern's props (and recursively their nested children),
|
|
23
23
|
* converting every fn-form lambda value into a React render-prop
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -47478,11 +47478,15 @@ function SlotContentRenderer({
|
|
|
47478
47478
|
}
|
|
47479
47479
|
if (propsSchema) {
|
|
47480
47480
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47481
|
-
const
|
|
47482
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47481
|
+
const isDate = propDef.types?.some(
|
|
47483
47482
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47484
|
-
)
|
|
47483
|
+
);
|
|
47484
|
+
if (!isDate) continue;
|
|
47485
|
+
const v = renderedProps[propKey];
|
|
47486
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47485
47487
|
renderedProps[propKey] = new Date(v);
|
|
47488
|
+
} else if (v == null && propDef.required) {
|
|
47489
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47486
47490
|
}
|
|
47487
47491
|
}
|
|
47488
47492
|
}
|
|
@@ -47726,12 +47730,26 @@ function createClientEffectHandlers(options) {
|
|
|
47726
47730
|
}
|
|
47727
47731
|
var lambdaLog = logger.createLogger("almadar:ui:fn-form-lambda");
|
|
47728
47732
|
function isFnFormLambda(value) {
|
|
47729
|
-
|
|
47733
|
+
if (!Array.isArray(value)) return false;
|
|
47734
|
+
const arr = value;
|
|
47735
|
+
if (arr.length !== 3 || arr[0] !== "fn" || arr[2] === null || typeof arr[2] !== "object") {
|
|
47736
|
+
return false;
|
|
47737
|
+
}
|
|
47738
|
+
const params = arr[1];
|
|
47739
|
+
return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p2) => typeof p2 === "string");
|
|
47740
|
+
}
|
|
47741
|
+
function fnFormParams(value) {
|
|
47742
|
+
const p2 = value[1];
|
|
47743
|
+
if (typeof p2 === "string") return [p2];
|
|
47744
|
+
if (Array.isArray(p2)) return p2.filter((x) => typeof x === "string");
|
|
47745
|
+
return [];
|
|
47730
47746
|
}
|
|
47731
|
-
function resolveLambdaBindings(body,
|
|
47732
|
-
const
|
|
47747
|
+
function resolveLambdaBindings(body, params, item, index) {
|
|
47748
|
+
const itemName = params[0];
|
|
47749
|
+
const indexName = params[1];
|
|
47750
|
+
const itemPrefix = itemName ? `@${itemName}.` : null;
|
|
47733
47751
|
const lookup = (path) => {
|
|
47734
|
-
let cur =
|
|
47752
|
+
let cur = item;
|
|
47735
47753
|
for (const seg of path.split(".")) {
|
|
47736
47754
|
if (cur === null || cur === void 0) return void 0;
|
|
47737
47755
|
if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
@@ -47739,21 +47757,23 @@ function resolveLambdaBindings(body, argName, arg) {
|
|
|
47739
47757
|
}
|
|
47740
47758
|
return cur;
|
|
47741
47759
|
};
|
|
47760
|
+
const recur = (b) => resolveLambdaBindings(b, params, item, index);
|
|
47742
47761
|
if (typeof body === "string") {
|
|
47743
|
-
if (body === `@${
|
|
47744
|
-
if (body
|
|
47745
|
-
|
|
47762
|
+
if (indexName && body === `@${indexName}`) return index;
|
|
47763
|
+
if (itemName && body === `@${itemName}`) return item;
|
|
47764
|
+
if (itemPrefix && body.startsWith(itemPrefix)) {
|
|
47765
|
+
const v = lookup(body.slice(itemPrefix.length));
|
|
47746
47766
|
return v === void 0 || v === null ? "" : v;
|
|
47747
47767
|
}
|
|
47748
47768
|
return body;
|
|
47749
47769
|
}
|
|
47750
47770
|
if (Array.isArray(body)) {
|
|
47751
|
-
return body.map((b) =>
|
|
47771
|
+
return body.map((b) => recur(b));
|
|
47752
47772
|
}
|
|
47753
47773
|
if (body !== null && typeof body === "object" && !React85__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
47754
47774
|
const out = {};
|
|
47755
47775
|
for (const [k, v] of Object.entries(body)) {
|
|
47756
|
-
out[k] =
|
|
47776
|
+
out[k] = recur(v);
|
|
47757
47777
|
}
|
|
47758
47778
|
return out;
|
|
47759
47779
|
}
|
|
@@ -47766,9 +47786,9 @@ function getSlotContentRenderer2() {
|
|
|
47766
47786
|
_slotContentRenderer2 = mod.SlotContentRenderer;
|
|
47767
47787
|
return _slotContentRenderer2;
|
|
47768
47788
|
}
|
|
47769
|
-
function makeLambdaFn(
|
|
47789
|
+
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
47770
47790
|
return (item, index) => {
|
|
47771
|
-
const resolvedBody = resolveLambdaBindings(lambdaBody,
|
|
47791
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
47772
47792
|
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React85__namespace.default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
47773
47793
|
return null;
|
|
47774
47794
|
}
|
|
@@ -47795,8 +47815,8 @@ function convertNode(node, callerKey) {
|
|
|
47795
47815
|
if (node === null || node === void 0) return node;
|
|
47796
47816
|
if (Array.isArray(node)) {
|
|
47797
47817
|
if (isFnFormLambda(node)) {
|
|
47798
|
-
const
|
|
47799
|
-
return makeLambdaFn(
|
|
47818
|
+
const arr2 = node;
|
|
47819
|
+
return makeLambdaFn(fnFormParams(arr2), arr2[2], callerKey);
|
|
47800
47820
|
}
|
|
47801
47821
|
const arr = node;
|
|
47802
47822
|
let anyChanged = false;
|
|
@@ -47818,9 +47838,9 @@ function convertObjectProps(props) {
|
|
|
47818
47838
|
for (const [key, value] of Object.entries(props)) {
|
|
47819
47839
|
if (isFnFormLambda(value)) {
|
|
47820
47840
|
convertedAny = true;
|
|
47821
|
-
const
|
|
47841
|
+
const arr = value;
|
|
47822
47842
|
const targetKey = key === "renderItem" ? "children" : key;
|
|
47823
|
-
out[targetKey] = makeLambdaFn(
|
|
47843
|
+
out[targetKey] = makeLambdaFn(fnFormParams(arr), arr[2], key);
|
|
47824
47844
|
lambdaLog.debug(`convert key=${key} \u2192 ${targetKey}`);
|
|
47825
47845
|
continue;
|
|
47826
47846
|
}
|
package/dist/runtime/index.js
CHANGED
|
@@ -47429,11 +47429,15 @@ function SlotContentRenderer({
|
|
|
47429
47429
|
}
|
|
47430
47430
|
if (propsSchema) {
|
|
47431
47431
|
for (const [propKey, propDef] of Object.entries(propsSchema)) {
|
|
47432
|
-
const
|
|
47433
|
-
if ((typeof v === "string" || typeof v === "number") && propDef.types?.some(
|
|
47432
|
+
const isDate = propDef.types?.some(
|
|
47434
47433
|
(t) => t === "date" || t === "datetime" || t === "timestamp"
|
|
47435
|
-
)
|
|
47434
|
+
);
|
|
47435
|
+
if (!isDate) continue;
|
|
47436
|
+
const v = renderedProps[propKey];
|
|
47437
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
47436
47438
|
renderedProps[propKey] = new Date(v);
|
|
47439
|
+
} else if (v == null && propDef.required) {
|
|
47440
|
+
renderedProps[propKey] = /* @__PURE__ */ new Date();
|
|
47437
47441
|
}
|
|
47438
47442
|
}
|
|
47439
47443
|
}
|
|
@@ -47677,12 +47681,26 @@ function createClientEffectHandlers(options) {
|
|
|
47677
47681
|
}
|
|
47678
47682
|
var lambdaLog = createLogger("almadar:ui:fn-form-lambda");
|
|
47679
47683
|
function isFnFormLambda(value) {
|
|
47680
|
-
|
|
47684
|
+
if (!Array.isArray(value)) return false;
|
|
47685
|
+
const arr = value;
|
|
47686
|
+
if (arr.length !== 3 || arr[0] !== "fn" || arr[2] === null || typeof arr[2] !== "object") {
|
|
47687
|
+
return false;
|
|
47688
|
+
}
|
|
47689
|
+
const params = arr[1];
|
|
47690
|
+
return typeof params === "string" || Array.isArray(params) && params.length > 0 && params.every((p2) => typeof p2 === "string");
|
|
47691
|
+
}
|
|
47692
|
+
function fnFormParams(value) {
|
|
47693
|
+
const p2 = value[1];
|
|
47694
|
+
if (typeof p2 === "string") return [p2];
|
|
47695
|
+
if (Array.isArray(p2)) return p2.filter((x) => typeof x === "string");
|
|
47696
|
+
return [];
|
|
47681
47697
|
}
|
|
47682
|
-
function resolveLambdaBindings(body,
|
|
47683
|
-
const
|
|
47698
|
+
function resolveLambdaBindings(body, params, item, index) {
|
|
47699
|
+
const itemName = params[0];
|
|
47700
|
+
const indexName = params[1];
|
|
47701
|
+
const itemPrefix = itemName ? `@${itemName}.` : null;
|
|
47684
47702
|
const lookup = (path) => {
|
|
47685
|
-
let cur =
|
|
47703
|
+
let cur = item;
|
|
47686
47704
|
for (const seg of path.split(".")) {
|
|
47687
47705
|
if (cur === null || cur === void 0) return void 0;
|
|
47688
47706
|
if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
@@ -47690,21 +47708,23 @@ function resolveLambdaBindings(body, argName, arg) {
|
|
|
47690
47708
|
}
|
|
47691
47709
|
return cur;
|
|
47692
47710
|
};
|
|
47711
|
+
const recur = (b) => resolveLambdaBindings(b, params, item, index);
|
|
47693
47712
|
if (typeof body === "string") {
|
|
47694
|
-
if (body === `@${
|
|
47695
|
-
if (body
|
|
47696
|
-
|
|
47713
|
+
if (indexName && body === `@${indexName}`) return index;
|
|
47714
|
+
if (itemName && body === `@${itemName}`) return item;
|
|
47715
|
+
if (itemPrefix && body.startsWith(itemPrefix)) {
|
|
47716
|
+
const v = lookup(body.slice(itemPrefix.length));
|
|
47697
47717
|
return v === void 0 || v === null ? "" : v;
|
|
47698
47718
|
}
|
|
47699
47719
|
return body;
|
|
47700
47720
|
}
|
|
47701
47721
|
if (Array.isArray(body)) {
|
|
47702
|
-
return body.map((b) =>
|
|
47722
|
+
return body.map((b) => recur(b));
|
|
47703
47723
|
}
|
|
47704
47724
|
if (body !== null && typeof body === "object" && !React85__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
47705
47725
|
const out = {};
|
|
47706
47726
|
for (const [k, v] of Object.entries(body)) {
|
|
47707
|
-
out[k] =
|
|
47727
|
+
out[k] = recur(v);
|
|
47708
47728
|
}
|
|
47709
47729
|
return out;
|
|
47710
47730
|
}
|
|
@@ -47717,9 +47737,9 @@ function getSlotContentRenderer2() {
|
|
|
47717
47737
|
_slotContentRenderer2 = mod.SlotContentRenderer;
|
|
47718
47738
|
return _slotContentRenderer2;
|
|
47719
47739
|
}
|
|
47720
|
-
function makeLambdaFn(
|
|
47740
|
+
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
47721
47741
|
return (item, index) => {
|
|
47722
|
-
const resolvedBody = resolveLambdaBindings(lambdaBody,
|
|
47742
|
+
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
47723
47743
|
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React85__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
47724
47744
|
return null;
|
|
47725
47745
|
}
|
|
@@ -47746,8 +47766,8 @@ function convertNode(node, callerKey) {
|
|
|
47746
47766
|
if (node === null || node === void 0) return node;
|
|
47747
47767
|
if (Array.isArray(node)) {
|
|
47748
47768
|
if (isFnFormLambda(node)) {
|
|
47749
|
-
const
|
|
47750
|
-
return makeLambdaFn(
|
|
47769
|
+
const arr2 = node;
|
|
47770
|
+
return makeLambdaFn(fnFormParams(arr2), arr2[2], callerKey);
|
|
47751
47771
|
}
|
|
47752
47772
|
const arr = node;
|
|
47753
47773
|
let anyChanged = false;
|
|
@@ -47769,9 +47789,9 @@ function convertObjectProps(props) {
|
|
|
47769
47789
|
for (const [key, value] of Object.entries(props)) {
|
|
47770
47790
|
if (isFnFormLambda(value)) {
|
|
47771
47791
|
convertedAny = true;
|
|
47772
|
-
const
|
|
47792
|
+
const arr = value;
|
|
47773
47793
|
const targetKey = key === "renderItem" ? "children" : key;
|
|
47774
|
-
out[targetKey] = makeLambdaFn(
|
|
47794
|
+
out[targetKey] = makeLambdaFn(fnFormParams(arr), arr[2], key);
|
|
47775
47795
|
lambdaLog.debug(`convert key=${key} \u2192 ${targetKey}`);
|
|
47776
47796
|
continue;
|
|
47777
47797
|
}
|