@kodaris/krubble-app-components 1.0.168 → 1.0.169

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.
@@ -4680,6 +4680,41 @@
4680
4680
  * @csspart dropdown - The dropdown container
4681
4681
  */
4682
4682
  class KRDateRangePicker extends i$3 {
4683
+ /**
4684
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
4685
+ * field's own properties and is set only when present, so an absent key keeps the default.
4686
+ */
4687
+ static fromJSON(json) {
4688
+ const field = new KRDateRangePicker();
4689
+ if (json.name !== undefined) {
4690
+ field.name = json.name;
4691
+ }
4692
+ if (json.value !== undefined) {
4693
+ field.value = json.value;
4694
+ }
4695
+ if (json.relativeOptions !== undefined) {
4696
+ field.relativeOptions = json.relativeOptions;
4697
+ }
4698
+ if (json.disabled !== undefined) {
4699
+ field.disabled = json.disabled;
4700
+ }
4701
+ if (json.placeholder !== undefined) {
4702
+ field.placeholder = json.placeholder;
4703
+ }
4704
+ if (json.startDate !== undefined) {
4705
+ field.startDate = json.startDate;
4706
+ }
4707
+ if (json.endDate !== undefined) {
4708
+ field.endDate = json.endDate;
4709
+ }
4710
+ if (json.mode !== undefined) {
4711
+ field.mode = json.mode;
4712
+ }
4713
+ if (json.saveMode !== undefined) {
4714
+ field.saveMode = json.saveMode;
4715
+ }
4716
+ return field;
4717
+ }
4683
4718
  constructor() {
4684
4719
  super();
4685
4720
  /**
@@ -6321,6 +6356,56 @@
6321
6356
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6322
6357
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6323
6358
  };
6359
+ /**
6360
+ * An option for the krs-select-field component.
6361
+ *
6362
+ * @element krs-select-option
6363
+ * @slot - The option label content
6364
+ */
6365
+ class KRSelectOption extends i$3 {
6366
+ constructor() {
6367
+ super(...arguments);
6368
+ /**
6369
+ * The option value
6370
+ */
6371
+ this.value = '';
6372
+ /**
6373
+ * Whether the option is disabled
6374
+ */
6375
+ this.disabled = false;
6376
+ }
6377
+ /** Gets the label text from the slot */
6378
+ get label() {
6379
+ return this.textContent?.trim() || '';
6380
+ }
6381
+ render() {
6382
+ return b `<slot></slot>`;
6383
+ }
6384
+ }
6385
+ KRSelectOption.styles = i$6 `
6386
+ :host {
6387
+ display: none;
6388
+ }
6389
+ `;
6390
+ __decorate$j([
6391
+ n$1({ type: String })
6392
+ ], KRSelectOption.prototype, "value", void 0);
6393
+ __decorate$j([
6394
+ n$1({ type: Boolean })
6395
+ ], KRSelectOption.prototype, "disabled", void 0);
6396
+ // Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
6397
+ // the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
6398
+ // own copy) doesn't throw. First definition wins.
6399
+ if (!customElements.get('krs-select-option')) {
6400
+ customElements.define('krs-select-option', KRSelectOption);
6401
+ }
6402
+
6403
+ var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6404
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6405
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6406
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6407
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6408
+ };
6324
6409
  /**
6325
6410
  * A select dropdown component that works with native browser forms.
6326
6411
  *
@@ -6331,6 +6416,62 @@
6331
6416
  * @slot - The krs-select-option elements
6332
6417
  */
6333
6418
  class KRSelectField extends i$3 {
6419
+ /**
6420
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
6421
+ * field's own properties and is set only when present, so an absent key keeps the default.
6422
+ */
6423
+ static fromJSON(json) {
6424
+ const field = new KRSelectField();
6425
+ if (json.label !== undefined) {
6426
+ field.label = json.label;
6427
+ }
6428
+ if (json.name !== undefined) {
6429
+ field.name = json.name;
6430
+ }
6431
+ if (json.value !== undefined) {
6432
+ field.value = json.value;
6433
+ }
6434
+ if (json.placeholder !== undefined) {
6435
+ field.placeholder = json.placeholder;
6436
+ }
6437
+ if (json.disabled !== undefined) {
6438
+ field.disabled = json.disabled;
6439
+ }
6440
+ if (json.required !== undefined) {
6441
+ field.required = json.required;
6442
+ }
6443
+ if (json.readonly !== undefined) {
6444
+ field.readonly = json.readonly;
6445
+ }
6446
+ if (json.hint !== undefined) {
6447
+ field.hint = json.hint;
6448
+ }
6449
+ if (json.saveMode !== undefined) {
6450
+ field.saveMode = json.saveMode;
6451
+ }
6452
+ // Options are the field's krs-select-option children: a string, or { value, label, disabled }.
6453
+ if (Array.isArray(json.options)) {
6454
+ for (const option of json.options) {
6455
+ const element = new KRSelectOption();
6456
+ if (typeof option === 'string') {
6457
+ element.value = option;
6458
+ element.textContent = option;
6459
+ }
6460
+ else {
6461
+ element.value = option.value;
6462
+ element.textContent = option.value;
6463
+ if (option.label !== undefined) {
6464
+ element.textContent = option.label;
6465
+ }
6466
+ if (option.disabled !== undefined) {
6467
+ element.disabled = option.disabled;
6468
+ }
6469
+ }
6470
+ field.appendChild(element);
6471
+ }
6472
+ }
6473
+ return field;
6474
+ }
6334
6475
  constructor() {
6335
6476
  super();
6336
6477
  // The value the user last picked. While dirty, an external `value` set is reverted to this (see
@@ -6858,55 +6999,55 @@
6858
6999
  `];
6859
7000
  // Enable form association
6860
7001
  KRSelectField.formAssociated = true;
6861
- __decorate$j([
7002
+ __decorate$i([
6862
7003
  n$1({ type: String })
6863
7004
  ], KRSelectField.prototype, "label", void 0);
6864
- __decorate$j([
7005
+ __decorate$i([
6865
7006
  n$1({ type: String })
6866
7007
  ], KRSelectField.prototype, "name", void 0);
6867
- __decorate$j([
7008
+ __decorate$i([
6868
7009
  n$1({ type: String })
6869
7010
  ], KRSelectField.prototype, "value", void 0);
6870
- __decorate$j([
7011
+ __decorate$i([
6871
7012
  n$1({ type: String })
6872
7013
  ], KRSelectField.prototype, "placeholder", void 0);
6873
- __decorate$j([
7014
+ __decorate$i([
6874
7015
  n$1({ type: Boolean })
6875
7016
  ], KRSelectField.prototype, "disabled", void 0);
6876
- __decorate$j([
7017
+ __decorate$i([
6877
7018
  n$1({ type: Boolean })
6878
7019
  ], KRSelectField.prototype, "required", void 0);
6879
- __decorate$j([
7020
+ __decorate$i([
6880
7021
  n$1({ type: Boolean })
6881
7022
  ], KRSelectField.prototype, "readonly", void 0);
6882
- __decorate$j([
7023
+ __decorate$i([
6883
7024
  n$1({ type: String })
6884
7025
  ], KRSelectField.prototype, "hint", void 0);
6885
- __decorate$j([
7026
+ __decorate$i([
6886
7027
  n$1({
6887
7028
  type: Boolean,
6888
7029
  reflect: true,
6889
7030
  })
6890
7031
  ], KRSelectField.prototype, "dirty", void 0);
6891
- __decorate$j([
7032
+ __decorate$i([
6892
7033
  n$1({ attribute: 'save-mode' })
6893
7034
  ], KRSelectField.prototype, "saveMode", void 0);
6894
- __decorate$j([
7035
+ __decorate$i([
6895
7036
  n$1({
6896
7037
  type: Boolean,
6897
7038
  reflect: true,
6898
7039
  })
6899
7040
  ], KRSelectField.prototype, "saving", void 0);
6900
- __decorate$j([
7041
+ __decorate$i([
6901
7042
  r$1()
6902
7043
  ], KRSelectField.prototype, "_isOpen", void 0);
6903
- __decorate$j([
7044
+ __decorate$i([
6904
7045
  r$1()
6905
7046
  ], KRSelectField.prototype, "_highlightedIndex", void 0);
6906
- __decorate$j([
7047
+ __decorate$i([
6907
7048
  r$1()
6908
7049
  ], KRSelectField.prototype, "_touched", void 0);
6909
- __decorate$j([
7050
+ __decorate$i([
6910
7051
  e$3('.select-trigger')
6911
7052
  ], KRSelectField.prototype, "_triggerElement", void 0);
6912
7053
  // Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
@@ -6916,56 +7057,6 @@
6916
7057
  customElements.define('krs-select-field', KRSelectField);
6917
7058
  }
6918
7059
 
6919
- var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
6920
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6921
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6922
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6923
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6924
- };
6925
- /**
6926
- * An option for the krs-select-field component.
6927
- *
6928
- * @element krs-select-option
6929
- * @slot - The option label content
6930
- */
6931
- class KRSelectOption extends i$3 {
6932
- constructor() {
6933
- super(...arguments);
6934
- /**
6935
- * The option value
6936
- */
6937
- this.value = '';
6938
- /**
6939
- * Whether the option is disabled
6940
- */
6941
- this.disabled = false;
6942
- }
6943
- /** Gets the label text from the slot */
6944
- get label() {
6945
- return this.textContent?.trim() || '';
6946
- }
6947
- render() {
6948
- return b `<slot></slot>`;
6949
- }
6950
- }
6951
- KRSelectOption.styles = i$6 `
6952
- :host {
6953
- display: none;
6954
- }
6955
- `;
6956
- __decorate$i([
6957
- n$1({ type: String })
6958
- ], KRSelectOption.prototype, "value", void 0);
6959
- __decorate$i([
6960
- n$1({ type: Boolean })
6961
- ], KRSelectOption.prototype, "disabled", void 0);
6962
- // Guarded registration: no-op if the tag is already defined, so a second copy of krubble on
6963
- // the page (e.g. the Operations shell loads krubble globally while an embedded app bundled its
6964
- // own copy) doesn't throw. First definition wins.
6965
- if (!customElements.get('krs-select-option')) {
6966
- customElements.define('krs-select-option', KRSelectOption);
6967
- }
6968
-
6969
7060
  /** Data-driven operator metadata map */
6970
7061
  const KR_OPERATORS = {
6971
7062
  equals: {
@@ -10898,6 +10989,38 @@
10898
10989
  * @fires change - Fired when the checked state changes
10899
10990
  */
10900
10991
  class KRCheckbox extends i$3 {
10992
+ /**
10993
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
10994
+ * field's own properties and is set only when present, so an absent key keeps the default.
10995
+ */
10996
+ static fromJSON(json) {
10997
+ const field = new KRCheckbox();
10998
+ if (json.label !== undefined) {
10999
+ field.label = json.label;
11000
+ }
11001
+ if (json.name !== undefined) {
11002
+ field.name = json.name;
11003
+ }
11004
+ if (json.value !== undefined) {
11005
+ field.value = json.value;
11006
+ }
11007
+ if (json.checked !== undefined) {
11008
+ field.checked = json.checked;
11009
+ }
11010
+ if (json.disabled !== undefined) {
11011
+ field.disabled = json.disabled;
11012
+ }
11013
+ if (json.required !== undefined) {
11014
+ field.required = json.required;
11015
+ }
11016
+ if (json.hint !== undefined) {
11017
+ field.hint = json.hint;
11018
+ }
11019
+ if (json.saveMode !== undefined) {
11020
+ field.saveMode = json.saveMode;
11021
+ }
11022
+ return field;
11023
+ }
10901
11024
  constructor() {
10902
11025
  super();
10903
11026
  // The checked state the user last set. While dirty, an external `checked` set is reverted to this
@@ -15835,6 +15958,56 @@
15835
15958
  * Native input and change events bubble up from the inner input element.
15836
15959
  */
15837
15960
  class KRTextField extends i$3 {
15961
+ /**
15962
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
15963
+ * field's own properties and is set only when present, so an absent key keeps the default.
15964
+ */
15965
+ static fromJSON(json) {
15966
+ const field = new KRTextField();
15967
+ if (json.label !== undefined) {
15968
+ field.label = json.label;
15969
+ }
15970
+ if (json.name !== undefined) {
15971
+ field.name = json.name;
15972
+ }
15973
+ if (json.value !== undefined) {
15974
+ field.value = json.value;
15975
+ }
15976
+ if (json.placeholder !== undefined) {
15977
+ field.placeholder = json.placeholder;
15978
+ }
15979
+ if (json.type !== undefined) {
15980
+ field.type = json.type;
15981
+ }
15982
+ if (json.required !== undefined) {
15983
+ field.required = json.required;
15984
+ }
15985
+ if (json.disabled !== undefined) {
15986
+ field.disabled = json.disabled;
15987
+ }
15988
+ if (json.readonly !== undefined) {
15989
+ field.readonly = json.readonly;
15990
+ }
15991
+ if (json.minlength !== undefined) {
15992
+ field.minlength = json.minlength;
15993
+ }
15994
+ if (json.maxlength !== undefined) {
15995
+ field.maxlength = json.maxlength;
15996
+ }
15997
+ if (json.pattern !== undefined) {
15998
+ field.pattern = json.pattern;
15999
+ }
16000
+ if (json.autocomplete !== undefined) {
16001
+ field.autocomplete = json.autocomplete;
16002
+ }
16003
+ if (json.hint !== undefined) {
16004
+ field.hint = json.hint;
16005
+ }
16006
+ if (json.saveMode !== undefined) {
16007
+ field.saveMode = json.saveMode;
16008
+ }
16009
+ return field;
16010
+ }
15838
16011
  constructor() {
15839
16012
  super();
15840
16013
  // The value the user last typed. While dirty, an external `value` set is reverted to this (see
@@ -16233,6 +16406,56 @@
16233
16406
  * @element krs-textarea-field
16234
16407
  */
16235
16408
  class KRTextareaField extends i$3 {
16409
+ /**
16410
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
16411
+ * field's own properties and is set only when present, so an absent key keeps the default.
16412
+ */
16413
+ static fromJSON(json) {
16414
+ const field = new KRTextareaField();
16415
+ if (json.label !== undefined) {
16416
+ field.label = json.label;
16417
+ }
16418
+ if (json.name !== undefined) {
16419
+ field.name = json.name;
16420
+ }
16421
+ if (json.value !== undefined) {
16422
+ field.value = json.value;
16423
+ }
16424
+ if (json.placeholder !== undefined) {
16425
+ field.placeholder = json.placeholder;
16426
+ }
16427
+ if (json.required !== undefined) {
16428
+ field.required = json.required;
16429
+ }
16430
+ if (json.disabled !== undefined) {
16431
+ field.disabled = json.disabled;
16432
+ }
16433
+ if (json.readonly !== undefined) {
16434
+ field.readonly = json.readonly;
16435
+ }
16436
+ if (json.rows !== undefined) {
16437
+ field.rows = json.rows;
16438
+ }
16439
+ if (json.cols !== undefined) {
16440
+ field.cols = json.cols;
16441
+ }
16442
+ if (json.minlength !== undefined) {
16443
+ field.minlength = json.minlength;
16444
+ }
16445
+ if (json.maxlength !== undefined) {
16446
+ field.maxlength = json.maxlength;
16447
+ }
16448
+ if (json.autocomplete !== undefined) {
16449
+ field.autocomplete = json.autocomplete;
16450
+ }
16451
+ if (json.hint !== undefined) {
16452
+ field.hint = json.hint;
16453
+ }
16454
+ if (json.saveMode !== undefined) {
16455
+ field.saveMode = json.saveMode;
16456
+ }
16457
+ return field;
16458
+ }
16236
16459
  constructor() {
16237
16460
  super();
16238
16461
  // The value the user last typed. While dirty, an external `value` set is reverted to this (see
@@ -16620,6 +16843,20 @@
16620
16843
  */
16621
16844
  this.value = '';
16622
16845
  }
16846
+ /**
16847
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
16848
+ * field's own properties and is set only when present, so an absent key keeps the default.
16849
+ */
16850
+ static fromJSON(json) {
16851
+ const field = new KRDetailField();
16852
+ if (json.label !== undefined) {
16853
+ field.label = json.label;
16854
+ }
16855
+ if (json.value !== undefined) {
16856
+ field.value = json.value;
16857
+ }
16858
+ return field;
16859
+ }
16623
16860
  render() {
16624
16861
  // A blank value shows an italicized "None" placeholder so an empty field reads as
16625
16862
  // intentionally empty rather than looking like a rendering gap.
@@ -16710,6 +16947,44 @@
16710
16947
  * @slot - Not used
16711
16948
  */
16712
16949
  class KRAutoSuggest extends i$3 {
16950
+ /**
16951
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
16952
+ * field's own properties and is set only when present, so an absent key keeps the default.
16953
+ */
16954
+ static fromJSON(json) {
16955
+ const field = new KRAutoSuggest();
16956
+ if (json.label !== undefined) {
16957
+ field.label = json.label;
16958
+ }
16959
+ if (json.name !== undefined) {
16960
+ field.name = json.name;
16961
+ }
16962
+ if (json.value !== undefined) {
16963
+ field.value = json.value;
16964
+ }
16965
+ if (json.placeholder !== undefined) {
16966
+ field.placeholder = json.placeholder;
16967
+ }
16968
+ if (json.disabled !== undefined) {
16969
+ field.disabled = json.disabled;
16970
+ }
16971
+ if (json.readonly !== undefined) {
16972
+ field.readonly = json.readonly;
16973
+ }
16974
+ if (json.required !== undefined) {
16975
+ field.required = json.required;
16976
+ }
16977
+ if (json.hint !== undefined) {
16978
+ field.hint = json.hint;
16979
+ }
16980
+ if (json.options !== undefined) {
16981
+ field.options = json.options;
16982
+ }
16983
+ if (json.saveMode !== undefined) {
16984
+ field.saveMode = json.saveMode;
16985
+ }
16986
+ return field;
16987
+ }
16713
16988
  constructor() {
16714
16989
  super();
16715
16990
  // The value the user last typed or picked. While dirty, an external `value` set is reverted to
@@ -17361,6 +17636,56 @@
17361
17636
  * `{ option, value }` (value being the updated array) in multi-select mode.
17362
17637
  */
17363
17638
  class KRComboBox extends i$3 {
17639
+ /**
17640
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
17641
+ * field's own properties and is set only when present, so an absent key keeps the default.
17642
+ */
17643
+ static fromJSON(json) {
17644
+ const field = new KRComboBox();
17645
+ if (json.label !== undefined) {
17646
+ field.label = json.label;
17647
+ }
17648
+ if (json.name !== undefined) {
17649
+ field.name = json.name;
17650
+ }
17651
+ if (json.value !== undefined) {
17652
+ field.value = json.value;
17653
+ }
17654
+ if (json.multiple !== undefined) {
17655
+ field.multiple = json.multiple;
17656
+ }
17657
+ if (json.clearable !== undefined) {
17658
+ field.clearable = json.clearable;
17659
+ }
17660
+ if (json.placeholder !== undefined) {
17661
+ field.placeholder = json.placeholder;
17662
+ }
17663
+ if (json.disabled !== undefined) {
17664
+ field.disabled = json.disabled;
17665
+ }
17666
+ if (json.readonly !== undefined) {
17667
+ field.readonly = json.readonly;
17668
+ }
17669
+ if (json.required !== undefined) {
17670
+ field.required = json.required;
17671
+ }
17672
+ if (json.hint !== undefined) {
17673
+ field.hint = json.hint;
17674
+ }
17675
+ if (json.optionValue !== undefined) {
17676
+ field.optionValue = json.optionValue;
17677
+ }
17678
+ if (json.optionLabel !== undefined) {
17679
+ field.optionLabel = json.optionLabel;
17680
+ }
17681
+ if (json.options !== undefined) {
17682
+ field.options = json.options;
17683
+ }
17684
+ if (json.saveMode !== undefined) {
17685
+ field.saveMode = json.saveMode;
17686
+ }
17687
+ return field;
17688
+ }
17364
17689
  constructor() {
17365
17690
  super();
17366
17691
  // The value the user last picked. While dirty, an external `value` set is reverted to this (see
@@ -18336,6 +18661,41 @@
18336
18661
  * @fires change - Fired when the selected value changes
18337
18662
  */
18338
18663
  class KRRadioCards extends i$3 {
18664
+ /**
18665
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
18666
+ * field's own properties and is set only when present, so an absent key keeps the default.
18667
+ */
18668
+ static fromJSON(json) {
18669
+ const field = new KRRadioCards();
18670
+ if (json.label !== undefined) {
18671
+ field.label = json.label;
18672
+ }
18673
+ if (json.name !== undefined) {
18674
+ field.name = json.name;
18675
+ }
18676
+ if (json.value !== undefined) {
18677
+ field.value = json.value;
18678
+ }
18679
+ if (json.options !== undefined) {
18680
+ field.options = json.options;
18681
+ }
18682
+ if (json.disabled !== undefined) {
18683
+ field.disabled = json.disabled;
18684
+ }
18685
+ if (json.required !== undefined) {
18686
+ field.required = json.required;
18687
+ }
18688
+ if (json.hint !== undefined) {
18689
+ field.hint = json.hint;
18690
+ }
18691
+ if (json.direction !== undefined) {
18692
+ field.direction = json.direction;
18693
+ }
18694
+ if (json.saveMode !== undefined) {
18695
+ field.saveMode = json.saveMode;
18696
+ }
18697
+ return field;
18698
+ }
18339
18699
  constructor() {
18340
18700
  super();
18341
18701
  // The value the user last picked. While dirty, an external `value` set is reverted to this (see
@@ -18792,6 +19152,53 @@
18792
19152
  * @fires input - Fired when the value changes via typing or calendar selection.
18793
19153
  */
18794
19154
  class KRDatePicker extends i$3 {
19155
+ /**
19156
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
19157
+ * field's own properties and is set only when present, so an absent key keeps the default.
19158
+ */
19159
+ static fromJSON(json) {
19160
+ const field = new KRDatePicker();
19161
+ if (json.label !== undefined) {
19162
+ field.label = json.label;
19163
+ }
19164
+ if (json.name !== undefined) {
19165
+ field.name = json.name;
19166
+ }
19167
+ if (json.value !== undefined) {
19168
+ field.value = json.value;
19169
+ }
19170
+ if (json.placeholder !== undefined) {
19171
+ field.placeholder = json.placeholder;
19172
+ }
19173
+ if (json.disabled !== undefined) {
19174
+ field.disabled = json.disabled;
19175
+ }
19176
+ if (json.required !== undefined) {
19177
+ field.required = json.required;
19178
+ }
19179
+ if (json.readonly !== undefined) {
19180
+ field.readonly = json.readonly;
19181
+ }
19182
+ if (json.min !== undefined) {
19183
+ field.min = json.min;
19184
+ }
19185
+ if (json.max !== undefined) {
19186
+ field.max = json.max;
19187
+ }
19188
+ if (json.step !== undefined) {
19189
+ field.step = json.step;
19190
+ }
19191
+ if (json.hint !== undefined) {
19192
+ field.hint = json.hint;
19193
+ }
19194
+ if (json.disableWeekends !== undefined) {
19195
+ field.disableWeekends = json.disableWeekends;
19196
+ }
19197
+ if (json.saveMode !== undefined) {
19198
+ field.saveMode = json.saveMode;
19199
+ }
19200
+ return field;
19201
+ }
18795
19202
  constructor() {
18796
19203
  super();
18797
19204
  // The value the user last committed. While dirty, an external `value` set is reverted to this
@@ -19906,6 +20313,44 @@
19906
20313
  * displays it in place of the placeholder. A fresh selection always takes precedence.
19907
20314
  */
19908
20315
  class KRFileField extends i$3 {
20316
+ /**
20317
+ * Builds a field from a plain object, as a tool's UI spec describes one. Every key is one of this
20318
+ * field's own properties and is set only when present, so an absent key keeps the default.
20319
+ */
20320
+ static fromJSON(json) {
20321
+ const field = new KRFileField();
20322
+ if (json.label !== undefined) {
20323
+ field.label = json.label;
20324
+ }
20325
+ if (json.name !== undefined) {
20326
+ field.name = json.name;
20327
+ }
20328
+ if (json.accept !== undefined) {
20329
+ field.accept = json.accept;
20330
+ }
20331
+ if (json.multiple !== undefined) {
20332
+ field.multiple = json.multiple;
20333
+ }
20334
+ if (json.placeholder !== undefined) {
20335
+ field.placeholder = json.placeholder;
20336
+ }
20337
+ if (json.value !== undefined) {
20338
+ field.value = json.value;
20339
+ }
20340
+ if (json.buttonLabel !== undefined) {
20341
+ field.buttonLabel = json.buttonLabel;
20342
+ }
20343
+ if (json.required !== undefined) {
20344
+ field.required = json.required;
20345
+ }
20346
+ if (json.disabled !== undefined) {
20347
+ field.disabled = json.disabled;
20348
+ }
20349
+ if (json.hint !== undefined) {
20350
+ field.hint = json.hint;
20351
+ }
20352
+ return field;
20353
+ }
19909
20354
  constructor() {
19910
20355
  super();
19911
20356
  /**
@@ -20453,6 +20898,58 @@
20453
20898
  });
20454
20899
  };
20455
20900
  }
20901
+ /**
20902
+ * Builds one field from a plain object whose `type` names the control, as a tool's UI spec describes
20903
+ * an input. The type is the control's own name, its tag without the `kr-` prefix: `text-field`,
20904
+ * `textarea-field`, `checkbox`, `select-field`, `combo-box`, `date-picker`, `date-range-picker`,
20905
+ * `auto-suggest`, `radio-cards`, `file-field`, `detail-field` or `monaco`. The other keys are the
20906
+ * control's own properties and go to its static `fromJSON`. `monaco` is built only when the caller has
20907
+ * imported kr-monaco, since the editor is heavy and not every form needs it. An unknown type returns
20908
+ * undefined.
20909
+ */
20910
+ static fromJSON(json) {
20911
+ if (json.type === 'text-field') {
20912
+ return KRTextField.fromJSON(json);
20913
+ }
20914
+ if (json.type === 'textarea-field') {
20915
+ return KRTextareaField.fromJSON(json);
20916
+ }
20917
+ if (json.type === 'checkbox') {
20918
+ return KRCheckbox.fromJSON(json);
20919
+ }
20920
+ if (json.type === 'select-field') {
20921
+ return KRSelectField.fromJSON(json);
20922
+ }
20923
+ if (json.type === 'combo-box') {
20924
+ return KRComboBox.fromJSON(json);
20925
+ }
20926
+ if (json.type === 'date-picker') {
20927
+ return KRDatePicker.fromJSON(json);
20928
+ }
20929
+ if (json.type === 'date-range-picker') {
20930
+ return KRDateRangePicker.fromJSON(json);
20931
+ }
20932
+ if (json.type === 'auto-suggest') {
20933
+ return KRAutoSuggest.fromJSON(json);
20934
+ }
20935
+ if (json.type === 'radio-cards') {
20936
+ return KRRadioCards.fromJSON(json);
20937
+ }
20938
+ if (json.type === 'file-field') {
20939
+ return KRFileField.fromJSON(json);
20940
+ }
20941
+ if (json.type === 'detail-field') {
20942
+ return KRDetailField.fromJSON(json);
20943
+ }
20944
+ if (json.type === 'monaco') {
20945
+ const monaco = customElements.get('kr-monaco');
20946
+ if (!monaco) {
20947
+ return undefined;
20948
+ }
20949
+ return monaco.fromJSON(json);
20950
+ }
20951
+ return undefined;
20952
+ }
20456
20953
  connectedCallback() {
20457
20954
  super.connectedCallback();
20458
20955
  this.addEventListener('change', this._handleChange);