@saltcorn/data 0.7.3-beta.6 → 0.7.3-beta.7

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.
@@ -47,6 +47,17 @@ declare const _exports: {
47
47
  */
48
48
  run: (file_id: string, file_name: string) => img;
49
49
  };
50
+ upload: {
51
+ isEdit: boolean;
52
+ multipartFormData: boolean;
53
+ valueIsFilename: boolean;
54
+ run: (nm: any, file_name: any, attrs: any, cls: any, reqd: any, field: any) => string;
55
+ };
56
+ select: {
57
+ isEdit: boolean;
58
+ setsFileId: boolean;
59
+ run: (nm: any, file_id: any, attrs: any, cls: any, reqd: any, field: any) => any;
60
+ };
50
61
  Thumbnail: {
51
62
  configFields: () => {
52
63
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"fileviews.d.ts","sourceRoot":"","sources":["../../base-plugin/fileviews.js"],"names":[],"mappings":";IAWE;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAWnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAYnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAWnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM"}
1
+ {"version":3,"file":"fileviews.d.ts","sourceRoot":"","sources":["../../base-plugin/fileviews.js"],"names":[],"mappings":";IAqBE;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAWnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAYnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM;;IAWnB;;;OAGG;;QAED;;;;WAIG;uBAHQ,MAAM,aACN,MAAM"}
@@ -4,10 +4,10 @@
4
4
  * @module base-plugin/fileview
5
5
  * @subcategory base-plugin
6
6
  */
7
- const { a, img, script, domReady } = require("@saltcorn/markup/tags");
7
+ const { a, img, script, domReady, select, input, div, text, text_attr, } = require("@saltcorn/markup/tags");
8
8
  const { link } = require("@saltcorn/markup");
9
9
  const { isNode } = require("../utils");
10
- const { div } = require("@saltcorn/markup");
10
+ const { select_options } = require("@saltcorn/markup/helpers");
11
11
  module.exports = {
12
12
  /**
13
13
  * @namespace
@@ -70,6 +70,33 @@ module.exports = {
70
70
  }
71
71
  },
72
72
  },
73
+ upload: {
74
+ isEdit: true,
75
+ multipartFormData: true,
76
+ valueIsFilename: true,
77
+ run: (nm, file_name, attrs, cls, reqd, field) => {
78
+ return (text(file_name || "") +
79
+ input({
80
+ class: `${cls} ${field.class || ""}`,
81
+ "data-fieldname": field.form_name,
82
+ name: text_attr(nm),
83
+ id: `input${text_attr(nm)}`,
84
+ type: "file",
85
+ }));
86
+ },
87
+ },
88
+ select: {
89
+ isEdit: true,
90
+ setsFileId: true,
91
+ run: (nm, file_id, attrs, cls, reqd, field) => {
92
+ return select({
93
+ class: `form-control form-select ${cls} ${field.class || ""}`,
94
+ "data-fieldname": field.form_name,
95
+ name: text_attr(nm),
96
+ id: `input${text_attr(nm)}`,
97
+ }, select_options(file_id, field, (attrs || {}).force_required, (attrs || {}).neutral_label));
98
+ },
99
+ },
73
100
  Thumbnail: {
74
101
  configFields: () => [
75
102
  { name: "width", type: "Integer", label: "Width (px)" },
@@ -1 +1 @@
1
- {"version":3,"file":"fileviews.js","sourceRoot":"","sources":["../../base-plugin/fileviews.js"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACtE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE5C,MAA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C,EACrC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,OAAO,MAAM,SAAS,IAAI,CAAC,CAAC,CAClE,CAAC;aACH;QACH,CAAC;KACF;CACF,CAAC"}
@@ -231,7 +231,7 @@ export const types: ({
231
231
  label: string;
232
232
  type: string;
233
233
  }[];
234
- run: (nm: any, v: any, attrs: {} | undefined, cls: any, requiZred: any, field: any, state?: {}) => any;
234
+ run: (nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}) => any;
235
235
  };
236
236
  below_input: {
237
237
  isEdit: boolean;
@@ -242,7 +242,29 @@ export const types: ({
242
242
  label: string;
243
243
  type: string;
244
244
  }[];
245
- run: (nm: any, v: any, attrs: {} | undefined, cls: any, requiZred: any, field: any, state?: {}) => any;
245
+ run: (nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}) => any;
246
+ };
247
+ show_star_rating: {
248
+ configFields: (field: any) => {
249
+ name: string;
250
+ type: string;
251
+ required: boolean;
252
+ default: number;
253
+ }[];
254
+ isEdit: boolean;
255
+ blockDisplay: boolean;
256
+ run: (v: any, req: any, attrs?: {}) => any;
257
+ };
258
+ edit_star_rating: {
259
+ configFields: (field: any) => {
260
+ name: string;
261
+ type: string;
262
+ required: boolean;
263
+ default: number;
264
+ }[];
265
+ isEdit: boolean;
266
+ blockDisplay: boolean;
267
+ run: (nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}) => any;
246
268
  };
247
269
  };
248
270
  attributes: object[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../base-plugin/index.js"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAsD;AACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA2E;;;;4CAG9D,MAAM;yCAYN,MAAM"}
@@ -286,10 +286,40 @@ export namespace int {
286
286
  type: string;
287
287
  }[];
288
288
  export { configFields_9 as configFields };
289
- export function run_16(nm: any, v: any, attrs: {} | undefined, cls: any, requiZred: any, field: any, state?: {}): any;
289
+ export function run_16(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
290
290
  export { run_16 as run };
291
291
  }
292
292
  export namespace below_input { }
293
+ export namespace show_star_rating {
294
+ export function configFields_10(field: any): {
295
+ name: string;
296
+ type: string;
297
+ required: boolean;
298
+ default: number;
299
+ }[];
300
+ export { configFields_10 as configFields };
301
+ const isEdit_17: boolean;
302
+ export { isEdit_17 as isEdit };
303
+ const blockDisplay_9: boolean;
304
+ export { blockDisplay_9 as blockDisplay };
305
+ export function run_17(v: any, req: any, attrs?: {}): any;
306
+ export { run_17 as run };
307
+ }
308
+ export namespace edit_star_rating {
309
+ export function configFields_11(field: any): {
310
+ name: string;
311
+ type: string;
312
+ required: boolean;
313
+ default: number;
314
+ }[];
315
+ export { configFields_11 as configFields };
316
+ const isEdit_18: boolean;
317
+ export { isEdit_18 as isEdit };
318
+ const blockDisplay_10: boolean;
319
+ export { blockDisplay_10 as blockDisplay };
320
+ export function run_18(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
321
+ export { run_18 as run };
322
+ }
293
323
  }
294
324
  export { fieldviews_1 as fieldviews };
295
325
  const attributes_1: object[];
@@ -310,37 +340,37 @@ export namespace bool {
310
340
  export { contract_2 as contract };
311
341
  export namespace fieldviews_2 {
312
342
  export namespace show_1 {
313
- const isEdit_17: boolean;
314
- export { isEdit_17 as isEdit };
315
- export function run_17(v: any): any;
316
- export { run_17 as run };
317
- }
318
- export { show_1 as show };
319
- export namespace checkboxes {
320
- const isEdit_18: boolean;
321
- export { isEdit_18 as isEdit };
322
- export function run_18(v: any): any;
323
- export { run_18 as run };
324
- }
325
- export namespace TrueFalse {
326
343
  const isEdit_19: boolean;
327
344
  export { isEdit_19 as isEdit };
328
- export function run_19(v: any): "" | "True" | "False";
345
+ export function run_19(v: any): any;
329
346
  export { run_19 as run };
330
347
  }
331
- export namespace edit_2 {
348
+ export { show_1 as show };
349
+ export namespace checkboxes {
332
350
  const isEdit_20: boolean;
333
351
  export { isEdit_20 as isEdit };
334
- export function run_20(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
352
+ export function run_20(v: any): any;
335
353
  export { run_20 as run };
336
354
  }
337
- export { edit_2 as edit };
338
- export namespace tristate {
355
+ export namespace TrueFalse {
339
356
  const isEdit_21: boolean;
340
357
  export { isEdit_21 as isEdit };
341
- export function run_21(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
358
+ export function run_21(v: any): "" | "True" | "False";
342
359
  export { run_21 as run };
343
360
  }
361
+ export namespace edit_2 {
362
+ const isEdit_22: boolean;
363
+ export { isEdit_22 as isEdit };
364
+ export function run_22(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
365
+ export { run_22 as run };
366
+ }
367
+ export { edit_2 as edit };
368
+ export namespace tristate {
369
+ const isEdit_23: boolean;
370
+ export { isEdit_23 as isEdit };
371
+ export function run_23(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
372
+ export { run_23 as run };
373
+ }
344
374
  }
345
375
  export { fieldviews_2 as fieldviews };
346
376
  const attributes_2: object[];
@@ -364,60 +394,60 @@ export namespace date {
364
394
  export { attributes_3 as attributes };
365
395
  export namespace fieldviews_3 {
366
396
  export namespace show_2 {
367
- const isEdit_22: boolean;
368
- export { isEdit_22 as isEdit };
369
- export function run_22(d: any, req: any): any;
370
- export { run_22 as run };
371
- }
372
- export { show_2 as show };
373
- export namespace showDay {
374
- const isEdit_23: boolean;
375
- export { isEdit_23 as isEdit };
376
- export function run_23(d: any, req: any): any;
377
- export { run_23 as run };
378
- }
379
- export namespace format {
380
397
  const isEdit_24: boolean;
381
398
  export { isEdit_24 as isEdit };
382
- const configFields_10: {
383
- name: string;
384
- label: string;
385
- type: string;
386
- sublabel: string;
387
- }[];
388
- export { configFields_10 as configFields };
389
- export function run_24(d: any, req: any, options: any): string;
399
+ export function run_24(d: any, req: any): any;
390
400
  export { run_24 as run };
391
401
  }
392
- export namespace relative {
402
+ export { show_2 as show };
403
+ export namespace showDay {
393
404
  const isEdit_25: boolean;
394
405
  export { isEdit_25 as isEdit };
395
- export function run_25(d: any, req: any): string;
406
+ export function run_25(d: any, req: any): any;
396
407
  export { run_25 as run };
397
408
  }
398
- export namespace yearsAgo {
409
+ export namespace format {
399
410
  const isEdit_26: boolean;
400
411
  export { isEdit_26 as isEdit };
401
- export function run_26(d: any, req: any): string;
412
+ const configFields_12: {
413
+ name: string;
414
+ label: string;
415
+ type: string;
416
+ sublabel: string;
417
+ }[];
418
+ export { configFields_12 as configFields };
419
+ export function run_26(d: any, req: any, options: any): string;
402
420
  export { run_26 as run };
403
421
  }
404
- export namespace edit_3 {
422
+ export namespace relative {
405
423
  const isEdit_27: boolean;
406
424
  export { isEdit_27 as isEdit };
407
- const blockDisplay_9: boolean;
408
- export { blockDisplay_9 as blockDisplay };
409
- export function run_27(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
425
+ export function run_27(d: any, req: any): string;
410
426
  export { run_27 as run };
411
427
  }
412
- export { edit_3 as edit };
413
- export namespace editDay {
428
+ export namespace yearsAgo {
414
429
  const isEdit_28: boolean;
415
430
  export { isEdit_28 as isEdit };
416
- const blockDisplay_10: boolean;
417
- export { blockDisplay_10 as blockDisplay };
418
- export function run_28(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
431
+ export function run_28(d: any, req: any): string;
419
432
  export { run_28 as run };
420
433
  }
434
+ export namespace edit_3 {
435
+ const isEdit_29: boolean;
436
+ export { isEdit_29 as isEdit };
437
+ const blockDisplay_11: boolean;
438
+ export { blockDisplay_11 as blockDisplay };
439
+ export function run_29(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
440
+ export { run_29 as run };
441
+ }
442
+ export { edit_3 as edit };
443
+ export namespace editDay {
444
+ const isEdit_30: boolean;
445
+ export { isEdit_30 as isEdit };
446
+ const blockDisplay_12: boolean;
447
+ export { blockDisplay_12 as blockDisplay };
448
+ export function run_30(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
449
+ export { run_30 as run };
450
+ }
421
451
  }
422
452
  export { fieldviews_3 as fieldviews };
423
453
  export namespace presets_1 {
@@ -441,19 +471,19 @@ export namespace float {
441
471
  export { contract_4 as contract };
442
472
  export namespace fieldviews_4 {
443
473
  export namespace show_3 {
444
- const isEdit_29: boolean;
445
- export { isEdit_29 as isEdit };
446
- export function run_29(s: any): string;
447
- export { run_29 as run };
474
+ const isEdit_31: boolean;
475
+ export { isEdit_31 as isEdit };
476
+ export function run_31(s: any): string;
477
+ export { run_31 as run };
448
478
  }
449
479
  export { show_3 as show };
450
480
  export namespace edit_4 {
451
- const isEdit_30: boolean;
452
- export { isEdit_30 as isEdit };
453
- const blockDisplay_11: boolean;
454
- export { blockDisplay_11 as blockDisplay };
455
- export function run_30(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
456
- export { run_30 as run };
481
+ const isEdit_32: boolean;
482
+ export { isEdit_32 as isEdit };
483
+ const blockDisplay_13: boolean;
484
+ export { blockDisplay_13 as blockDisplay };
485
+ export function run_32(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
486
+ export { run_32 as run };
457
487
  }
458
488
  export { edit_4 as edit };
459
489
  export namespace number_slider_1 { }
@@ -463,14 +493,14 @@ export namespace float {
463
493
  export namespace progress_bar_1 { }
464
494
  export { progress_bar_1 as progress_bar };
465
495
  export namespace above_input_1 {
466
- const isEdit_31: boolean;
467
- export { isEdit_31 as isEdit };
496
+ const isEdit_33: boolean;
497
+ export { isEdit_33 as isEdit };
468
498
  const isFilter_3: boolean;
469
499
  export { isFilter_3 as isFilter };
470
- const blockDisplay_12: boolean;
471
- export { blockDisplay_12 as blockDisplay };
472
- export function run_31(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
473
- export { run_31 as run };
500
+ const blockDisplay_14: boolean;
501
+ export { blockDisplay_14 as blockDisplay };
502
+ export function run_33(nm: any, v: any, attrs: {} | undefined, cls: any, required: any, field: any, state?: {}): any;
503
+ export { run_33 as run };
474
504
  }
475
505
  export { above_input_1 as above_input };
476
506
  export namespace below_input_1 { }
@@ -493,19 +523,19 @@ export namespace color {
493
523
  export { contract_5 as contract };
494
524
  export namespace fieldviews_5 {
495
525
  export namespace show_4 {
496
- const isEdit_32: boolean;
497
- export { isEdit_32 as isEdit };
498
- export function run_32(s: any): any;
499
- export { run_32 as run };
526
+ const isEdit_34: boolean;
527
+ export { isEdit_34 as isEdit };
528
+ export function run_34(s: any): any;
529
+ export { run_34 as run };
500
530
  }
501
531
  export { show_4 as show };
502
532
  export namespace edit_5 {
503
- const isEdit_33: boolean;
504
- export { isEdit_33 as isEdit };
505
- const blockDisplay_13: boolean;
506
- export { blockDisplay_13 as blockDisplay };
507
- export function run_33(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
508
- export { run_33 as run };
533
+ const isEdit_35: boolean;
534
+ export { isEdit_35 as isEdit };
535
+ const blockDisplay_15: boolean;
536
+ export { blockDisplay_15 as blockDisplay };
537
+ export function run_35(nm: any, v: any, attrs: any, cls: any, required: any, field: any): any;
538
+ export { run_35 as run };
509
539
  }
510
540
  export { edit_5 as edit };
511
541
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../base-plugin/types.js"],"names":[],"mappings":";gBAmSa,MAAM;oBAEN,MAAM;IAML,+CAqEX;IAMS;;gBAK+D;;;;YAYxC,6BAAyB;;;;;YAQjD,mCAAqD;;;;;;YASrD,yDAAmE;;;;;;YAOzC,mCAA6B;;;;;;;YAU9C;;;;;;;;;;;;;;;;;;;;;iBA8Bb;YACI,6FA8CG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiDH,6FAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCE,6FAoBF;;;;;;;;YAWE,6FAYF;;;;;;;;;;;;YAgBE,6FAaoB;;;;;;;;;;;;;YAYpB,6FAYoB;;;;;;;;YAWpB,8FAUD;;;;IAOF,0CAQL;;QAYK;;mBAAmB;QAMZ;;mBAAyD;;IAOpE,+FAYC;IAMkB,iFAEwB;;;kBAuBlC,MAAM;;sBAEN,MAAM;;IAQP;;;gBAAoD;;;;;;;;;YAahC,uCAAc;;;;;;;;;;;;;;YAYnC,8FAkBJ;;;;;YA70BS;;;;gBAOb;;;;;;YAGI,yGAkBD;;;;YAGU;;;;gBAOb;;;;;;;;YAKI,qHAiCJ;;;;YAIa;;;;;;;;;;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AgB;;;IAOjB,yDAWL;;IAMC,gDAEgC;;;;kBArSvB,MAAM;;sBAEN,MAAM;;IAQP;;;iBAAmD;;;;;;YAY/B,uCAAc;;;;;;;;;YAUnC,8FAeD;;;;;;;;;;;;;;;;;YAr6BH,qHAaD;;;;;;;;wBAg6BO,MAAM,EAAE;;IAWb,+DAUL;;IAMC,mEAKC;;;;kBAvKQ,MAAM;;sBAEN,MAAM;;IAKP,uCAAY;;;;;;YAcb,oCAMG;;;;;;;;;YAWH,8FAUD;;;;;;wBAGG,MAAM,EAAE;;IAMb,0CAOL;;IAIS,sCAET"}
@@ -8,7 +8,7 @@
8
8
  * @subcategory base-plugin
9
9
  */
10
10
  const moment = require("moment");
11
- const { input, select, option, text, div, h3, a, i, button, textarea, span, img, text_attr, script, domReady, section, } = require("@saltcorn/markup/tags");
11
+ const { input, select, option, text, div, h3, a, i, button, textarea, span, img, text_attr, label, script, domReady, section, } = require("@saltcorn/markup/tags");
12
12
  const { contract, is } = require("contractis");
13
13
  const { radio_group, checkbox_group } = require("@saltcorn/markup/helpers");
14
14
  const { getState } = require("../db/state");
@@ -123,7 +123,7 @@ const number_limit = (direction) => ({
123
123
  configFields: [
124
124
  { name: "stepper_btns", label: "Stepper buttons", type: "Bool" },
125
125
  ],
126
- run: (nm, v, attrs = {}, cls, requiZred, field, state = {}) => {
126
+ run: (nm, v, attrs = {}, cls, required, field, state = {}) => {
127
127
  const onChange = `set_state_field('_${direction}_${nm}', this.value)`;
128
128
  return attrs?.stepper_btns
129
129
  ? number_stepper(undefined, isdef(state[`_${direction}_${nm}`])
@@ -755,6 +755,45 @@ const int = {
755
755
  progress_bar: progress_bar("Integer"),
756
756
  above_input: number_limit("gte"),
757
757
  below_input: number_limit("lte"),
758
+ show_star_rating: {
759
+ configFields: (field) => [
760
+ ...(!isdef(field.attributes.min)
761
+ ? [{ name: "min", type: "Integer", required: true, default: 1 }]
762
+ : []),
763
+ ...(!isdef(field.attributes.max)
764
+ ? [{ name: "max", type: "Integer", required: true, default: 5 }]
765
+ : []),
766
+ ],
767
+ isEdit: false,
768
+ blockDisplay: true,
769
+ run: (v, req, attrs = {}) => div(Array.from({ length: attrs.max - attrs.min + 1 }, (_, i) => i + attrs.min).map((starVal) => i({
770
+ class: "fas fa-star",
771
+ style: { color: starVal <= v ? "#ffc107" : "#ddd" },
772
+ }))),
773
+ },
774
+ edit_star_rating: {
775
+ configFields: (field) => [
776
+ ...(!isdef(field.attributes.min)
777
+ ? [{ name: "min", type: "Integer", required: true, default: 1 }]
778
+ : []),
779
+ ...(!isdef(field.attributes.max)
780
+ ? [{ name: "max", type: "Integer", required: true, default: 5 }]
781
+ : []),
782
+ ],
783
+ isEdit: true,
784
+ blockDisplay: true,
785
+ run: (nm, v, attrs = {}, cls, required, field, state = {}) => {
786
+ //https://codepen.io/pezmotion/pen/RQERdm
787
+ return div({ class: "editStarRating" }, Array.from({ length: attrs.max - attrs.min + 1 }, (_, i) => attrs.max - i).map((starVal) => input({
788
+ id: `input${text_attr(nm)}-${starVal}`,
789
+ type: "radio",
790
+ name: text_attr(nm),
791
+ value: starVal,
792
+ checked: v === starVal,
793
+ }) +
794
+ label({ for: `input${text_attr(nm)}-${starVal}` }, i({ class: "fas fa-star" }))));
795
+ },
796
+ },
758
797
  },
759
798
  /** @type {object[]} */
760
799
  attributes: [