@streamline-pulse/formkrafter-wc 0.2.0 → 0.4.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.
Files changed (161) hide show
  1. package/README.md +10 -8
  2. package/dist/components/fk-brick-actions.js +1 -1
  3. package/dist/components/fk-brick-list.js +1 -1
  4. package/dist/components/fk-brick-mold-item.js +1 -1
  5. package/dist/components/fk-brick-not-found.js +1 -1
  6. package/dist/components/fk-brick-render.js +1 -1
  7. package/dist/components/fk-code-editor.js +1 -1
  8. package/dist/components/fk-data-grid.js +1 -1
  9. package/dist/components/fk-drop-area.js +1 -1
  10. package/dist/components/fk-empty-form.js +1 -1
  11. package/dist/components/fk-file-input.js +1 -1
  12. package/dist/components/fk-form-builder.js +1 -1
  13. package/dist/components/fk-form-render.js +1 -1
  14. package/dist/components/fk-property-panel.js +1 -1
  15. package/dist/components/fk-rules-editor.js +1 -1
  16. package/dist/components/fk-select-input.js +1 -1
  17. package/dist/components/fk-signature-input.js +1 -1
  18. package/dist/components/fk-stepper.js +1 -1
  19. package/dist/components/fk-tabs.js +1 -1
  20. package/dist/components/index.js +1 -1
  21. package/dist/components/{p-LXnm2ogM.js → p-28GBFlUX.js} +4 -4
  22. package/dist/components/p-BB4Llg42.js +1 -0
  23. package/dist/components/p-BGxmFcpL.js +1 -0
  24. package/dist/components/{p-BVBfbMl_.js → p-BInUBjyw.js} +1 -1
  25. package/dist/components/p-BietHxaT.js +1 -0
  26. package/dist/components/{p-C85zhhpr.js → p-BnzSarwW.js} +1 -1
  27. package/dist/components/p-BpkKcCCr.js +1 -0
  28. package/dist/components/p-C0Y8qh8R.js +1 -0
  29. package/dist/components/p-C5OWoRhO.js +1 -0
  30. package/dist/components/p-CKs1CWVz.js +1 -0
  31. package/dist/components/{p-BSPTuA1p.js → p-CZHykCYD.js} +1 -1
  32. package/dist/components/p-CehxuHtl.js +1 -0
  33. package/dist/components/p-CqVSd56Z.js +1 -0
  34. package/dist/components/p-CyZA17qf.js +1 -0
  35. package/dist/components/p-D4HhZxQ-.js +1 -0
  36. package/dist/components/p-DC6Wxbnz.js +1 -0
  37. package/dist/components/p-DRNycSdI.js +1 -0
  38. package/dist/components/{p-B0YjIsVn.js → p-Dh5Z49YD.js} +1 -1
  39. package/dist/components/p-DiOstAi9.js +1 -0
  40. package/dist/components/p-DlqnIm46.js +1 -0
  41. package/dist/components/{p-BDvqHJih.js → p-DshUS8Zm.js} +1 -1
  42. package/dist/components/p-DtcM1yw5.js +1 -0
  43. package/dist/components/p-NDbmiiYk.js +1 -0
  44. package/dist/components/p-RzeBwfwG.js +1 -0
  45. package/dist/components/p-ajy8ZcBX.js +1 -0
  46. package/dist/components/p-kYG3E0GQ.js +1 -0
  47. package/dist/components/p-tTJg_I4V.js +1 -0
  48. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  49. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  50. package/dist/formkrafter-wc/index.esm.js +1 -1
  51. package/dist/formkrafter-wc/p-3579150a.entry.js +1 -0
  52. package/dist/formkrafter-wc/p-8b0ff66e.entry.js +1 -0
  53. package/dist/formkrafter-wc/p-BHZMDq2e.js +1 -0
  54. package/dist/formkrafter-wc/p-BietHxaT.js +1 -0
  55. package/dist/formkrafter-wc/p-C0Y8qh8R.js +1 -0
  56. package/dist/formkrafter-wc/p-CehxuHtl.js +1 -0
  57. package/dist/formkrafter-wc/p-DlqnIm46.js +1 -0
  58. package/dist/formkrafter-wc/p-DtcM1yw5.js +1 -0
  59. package/dist/formkrafter-wc/p-RzeBwfwG.js +1 -0
  60. package/dist/formkrafter-wc/p-WWmY5Z05.js +1 -0
  61. package/dist/formkrafter-wc/p-hcT25XX4.js +12 -0
  62. package/dist/formkrafter-wc/p-qLZlXROB.js +2 -0
  63. package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +3 -1
  64. package/dist/types/components/fk-data-grid/fk-data-grid.d.ts +1 -0
  65. package/dist/types/components/fk-drop-area/fk-drop-area.d.ts +1 -0
  66. package/dist/types/components/fk-file-input/fk-file-input.d.ts +7 -3
  67. package/dist/types/components/fk-form-render/fk-form-render.d.ts +7 -1
  68. package/dist/types/components/fk-select-input/fk-select-input.d.ts +9 -0
  69. package/dist/types/components.d.ts +39 -4
  70. package/dist/types/index.d.ts +1 -1
  71. package/dist/types/registry/default-bricks.d.ts +36 -0
  72. package/dist/types/utils/mask.d.ts +1 -0
  73. package/package.json +10 -15
  74. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
  75. package/dist/cjs/fk-brick-actions_18.cjs.entry.js +0 -26443
  76. package/dist/cjs/formkrafter-wc.cjs.js +0 -25
  77. package/dist/cjs/index-Can2MpG5.js +0 -17538
  78. package/dist/cjs/index-CbyFxLc_.js +0 -2114
  79. package/dist/cjs/index.cjs.js +0 -48
  80. package/dist/cjs/loader.cjs.js +0 -13
  81. package/dist/collection/collection-manifest.json +0 -30
  82. package/dist/collection/components/fk-brick-actions/fk-brick-actions.css +0 -78
  83. package/dist/collection/components/fk-brick-actions/fk-brick-actions.js +0 -215
  84. package/dist/collection/components/fk-brick-list/fk-brick-list.css +0 -71
  85. package/dist/collection/components/fk-brick-list/fk-brick-list.js +0 -55
  86. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.css +0 -33
  87. package/dist/collection/components/fk-brick-mold-item/fk-brick-mold-item.js +0 -73
  88. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.css +0 -8
  89. package/dist/collection/components/fk-brick-not-found/fk-brick-not-found.js +0 -18
  90. package/dist/collection/components/fk-brick-render/fk-brick-render.js +0 -447
  91. package/dist/collection/components/fk-code-editor/fk-code-editor.css +0 -26
  92. package/dist/collection/components/fk-code-editor/fk-code-editor.js +0 -136
  93. package/dist/collection/components/fk-data-grid/fk-data-grid.css +0 -75
  94. package/dist/collection/components/fk-data-grid/fk-data-grid.js +0 -300
  95. package/dist/collection/components/fk-drop-area/fk-drop-area.css +0 -18
  96. package/dist/collection/components/fk-drop-area/fk-drop-area.js +0 -98
  97. package/dist/collection/components/fk-empty-form/fk-empty-form.css +0 -22
  98. package/dist/collection/components/fk-empty-form/fk-empty-form.js +0 -19
  99. package/dist/collection/components/fk-file-input/fk-file-input.css +0 -95
  100. package/dist/collection/components/fk-file-input/fk-file-input.js +0 -196
  101. package/dist/collection/components/fk-form-builder/fk-form-builder.css +0 -112
  102. package/dist/collection/components/fk-form-builder/fk-form-builder.js +0 -431
  103. package/dist/collection/components/fk-form-render/fk-form-render.css +0 -7
  104. package/dist/collection/components/fk-form-render/fk-form-render.js +0 -352
  105. package/dist/collection/components/fk-property-panel/fk-property-panel.css +0 -153
  106. package/dist/collection/components/fk-property-panel/fk-property-panel.js +0 -384
  107. package/dist/collection/components/fk-rules-editor/fk-rules-editor.css +0 -166
  108. package/dist/collection/components/fk-rules-editor/fk-rules-editor.js +0 -250
  109. package/dist/collection/components/fk-select-input/fk-select-input.css +0 -144
  110. package/dist/collection/components/fk-select-input/fk-select-input.js +0 -356
  111. package/dist/collection/components/fk-signature-input/fk-signature-input.css +0 -42
  112. package/dist/collection/components/fk-signature-input/fk-signature-input.js +0 -158
  113. package/dist/collection/components/fk-stepper/fk-stepper.css +0 -85
  114. package/dist/collection/components/fk-stepper/fk-stepper.js +0 -282
  115. package/dist/collection/components/fk-tabs/fk-tabs.css +0 -38
  116. package/dist/collection/components/fk-tabs/fk-tabs.js +0 -236
  117. package/dist/collection/i18n/i18n.js +0 -257
  118. package/dist/collection/index.js +0 -5
  119. package/dist/collection/registry/create-brick.js +0 -34
  120. package/dist/collection/registry/default-bricks.js +0 -562
  121. package/dist/collection/registry/registry.js +0 -44
  122. package/dist/collection/utils/brick-data.js +0 -16
  123. package/dist/collection/utils/drop.js +0 -14
  124. package/dist/collection/utils/events.js +0 -1
  125. package/dist/collection/utils/options.js +0 -21
  126. package/dist/collection/utils/remote.js +0 -27
  127. package/dist/collection/utils/rule-condition.js +0 -72
  128. package/dist/collection/utils/style.js +0 -11
  129. package/dist/components/p-B1t0M_hN.js +0 -1
  130. package/dist/components/p-B21cOFRx.js +0 -1
  131. package/dist/components/p-B7ED8qMb.js +0 -1
  132. package/dist/components/p-BrOXMyOG.js +0 -1
  133. package/dist/components/p-CMQ_4Zfv.js +0 -1
  134. package/dist/components/p-CWQX0sXS.js +0 -1
  135. package/dist/components/p-CXEvsomA.js +0 -1
  136. package/dist/components/p-Cq9HSEn8.js +0 -1
  137. package/dist/components/p-D7bf2ztq.js +0 -1
  138. package/dist/components/p-DIPoAaGe.js +0 -1
  139. package/dist/components/p-DYBirEew.js +0 -1
  140. package/dist/components/p-DluDp8V5.js +0 -1
  141. package/dist/components/p-Do6-yRva.js +0 -1
  142. package/dist/components/p-GjmAhT2E.js +0 -1
  143. package/dist/components/p-y0xDvzJR.js +0 -1
  144. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  145. package/dist/esm/fk-brick-actions_18.entry.js +0 -26424
  146. package/dist/esm/formkrafter-wc.js +0 -21
  147. package/dist/esm/index-BB2OOj__.js +0 -17478
  148. package/dist/esm/index-DMDO6w5-.js +0 -2105
  149. package/dist/esm/index.js +0 -2
  150. package/dist/esm/loader.js +0 -11
  151. package/dist/formkrafter-wc/p-0de7cbe1.entry.js +0 -1
  152. package/dist/formkrafter-wc/p-Bp_A8oL5.js +0 -12
  153. package/dist/formkrafter-wc/p-DMDO6w5-.js +0 -2
  154. package/dist/index.cjs.js +0 -1
  155. package/dist/index.js +0 -1
  156. package/dist/stencil.config.js +0 -34
  157. package/loader/cdn.js +0 -1
  158. package/loader/index.cjs.js +0 -1
  159. package/loader/index.d.ts +0 -24
  160. package/loader/index.es2017.js +0 -1
  161. package/loader/index.js +0 -2
@@ -1,282 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { iterateSchemaBricks, validateBrickSpecDataDetailed, } from "@streamline-pulse/formkrafter-core";
3
- import { fkT } from "../../i18n/i18n";
4
- export class FkStepper {
5
- constructor() {
6
- this.stepLabels = [];
7
- this.editable = false;
8
- this.active = 0;
9
- this.next = (event) => {
10
- event.preventDefault();
11
- if (this.config('validateSteps', false) && !this.stepValid(this.active)) {
12
- this.stepTouch.emit({ keys: this.stepKeys(this.active) });
13
- return;
14
- }
15
- this.active = Math.min(this.active + 1, this.stepLabels.length - 1);
16
- };
17
- this.back = (event) => {
18
- event.preventDefault();
19
- this.active = Math.max(this.active - 1, 0);
20
- };
21
- this.submit = (event) => {
22
- event.preventDefault();
23
- if (this.config('validateSteps', false) && !this.stepValid(this.active)) {
24
- this.stepTouch.emit({ keys: this.stepKeys(this.active) });
25
- return;
26
- }
27
- this.stepperSubmit.emit();
28
- };
29
- }
30
- clampActive() {
31
- if (this.active > Math.max(this.stepLabels.length - 1, 0)) {
32
- this.active = 0;
33
- }
34
- }
35
- componentDidRender() {
36
- const body = this.host.querySelector('.fk-stepper__body');
37
- if (!body)
38
- return;
39
- Array.from(body.children).forEach((child, index) => {
40
- const element = child;
41
- if (this.editable)
42
- element.style.removeProperty('display');
43
- else
44
- element.style.display = index === this.active ? '' : 'none';
45
- });
46
- }
47
- config(name, fallback) {
48
- var _a, _b;
49
- const raw = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b[name];
50
- return typeof raw === 'boolean' ? raw : fallback;
51
- }
52
- stepSpec(index) {
53
- var _a, _b, _c;
54
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
55
- if (!child || !this.spec)
56
- return undefined;
57
- if (((_c = this.stepCache) === null || _c === void 0 ? void 0 : _c.source) !== this.spec) {
58
- this.stepCache = { source: this.spec, specs: [] };
59
- }
60
- if (!this.stepCache.specs[index]) {
61
- this.stepCache.specs[index] = {
62
- type: 'panel',
63
- id: 'step',
64
- name: 'Step',
65
- configs: { key: `step_${index}` },
66
- children: [child],
67
- };
68
- }
69
- return this.stepCache.specs[index];
70
- }
71
- stepKeys(index) {
72
- var _a, _b, _c;
73
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
74
- if (!child)
75
- return [];
76
- const keys = [];
77
- for (const brick of iterateSchemaBricks(child)) {
78
- if ((_c = brick.configs) === null || _c === void 0 ? void 0 : _c.key)
79
- keys.push(brick.configs.key);
80
- }
81
- return keys;
82
- }
83
- stepValid(index) {
84
- var _a;
85
- const stepSpec = this.stepSpec(index);
86
- if (!stepSpec)
87
- return true;
88
- const present = Object.fromEntries(Object.entries((_a = this.dataMap) !== null && _a !== void 0 ? _a : {}).filter(([, value]) => value !== '' && value !== null && value !== undefined));
89
- return validateBrickSpecDataDetailed(stepSpec, present, this.locale).valid;
90
- }
91
- goToStep(index) {
92
- if (this.editable || index <= this.active) {
93
- this.active = index;
94
- return;
95
- }
96
- if (!this.config('allowStepClick', true))
97
- return;
98
- if (this.config('validateSteps', false)) {
99
- for (let i = this.active; i < index; i++) {
100
- if (!this.stepValid(i)) {
101
- this.active = i;
102
- this.stepTouch.emit({ keys: this.stepKeys(i) });
103
- return;
104
- }
105
- }
106
- }
107
- this.active = index;
108
- }
109
- render() {
110
- const lastStep = Math.max(this.stepLabels.length - 1, 0);
111
- const showSubmit = !this.editable && this.config('showSubmit', false) && this.active === lastStep;
112
- return (h("div", { key: '3a5a9d1aa6e870241cf5a353359fe89a7c4a376a', class: "fk-stepper" }, h("ol", { key: '8d6b154016d12cd00827b8bddbe4d476dc378fab', class: "fk-stepper__nav" }, this.stepLabels.map((label, index) => (h("li", { key: `${index}-${label}`, class: {
113
- 'fk-stepper__step': true,
114
- 'fk-stepper__step--active': index === this.active,
115
- 'fk-stepper__step--done': !this.editable && index < this.active,
116
- }, onClick: () => this.goToStep(index) }, h("span", { class: "fk-stepper__index" }, index + 1), h("span", { class: "fk-stepper__label" }, label))))), h("div", { key: 'c17a9bf5c76574072d45621fe819fd49671226f0', class: "fk-stepper__body" }, h("slot", { key: 'aa168f9a54babdb9c25cdbb79738b024944e94e3' })), !this.editable && this.stepLabels.length > 1 ? (h("div", { class: "fk-stepper__actions" }, h("button", { type: "button", class: "fk-stepper__button", disabled: this.active === 0, onClick: this.back }, fkT('stepper.back')), this.active < lastStep ? (h("button", { type: "button", class: "fk-stepper__button fk-stepper__button--primary", onClick: this.next }, fkT('stepper.next'))) : null, showSubmit ? (h("button", { type: "button", class: "fk-stepper__button fk-stepper__button--primary", onClick: this.submit }, fkT('stepper.submit'))) : null)) : null));
117
- }
118
- static get is() { return "fk-stepper"; }
119
- static get encapsulation() { return "scoped"; }
120
- static get originalStyleUrls() {
121
- return {
122
- "$": ["fk-stepper.css"]
123
- };
124
- }
125
- static get styleUrls() {
126
- return {
127
- "$": ["fk-stepper.css"]
128
- };
129
- }
130
- static get properties() {
131
- return {
132
- "stepLabels": {
133
- "type": "unknown",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "string[]",
137
- "resolved": "string[]",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": ""
145
- },
146
- "getter": false,
147
- "setter": false,
148
- "defaultValue": "[]"
149
- },
150
- "editable": {
151
- "type": "boolean",
152
- "mutable": false,
153
- "complexType": {
154
- "original": "boolean",
155
- "resolved": "boolean",
156
- "references": {}
157
- },
158
- "required": false,
159
- "optional": false,
160
- "docs": {
161
- "tags": [],
162
- "text": ""
163
- },
164
- "getter": false,
165
- "setter": false,
166
- "reflect": false,
167
- "attribute": "editable",
168
- "defaultValue": "false"
169
- },
170
- "spec": {
171
- "type": "unknown",
172
- "mutable": false,
173
- "complexType": {
174
- "original": "BrickSpec",
175
- "resolved": "BrickSpec",
176
- "references": {
177
- "BrickSpec": {
178
- "location": "import",
179
- "path": "@streamline-pulse/formkrafter-core",
180
- "id": "../core/dist/index.d.ts::BrickSpec",
181
- "referenceLocation": "BrickSpec"
182
- }
183
- }
184
- },
185
- "required": false,
186
- "optional": true,
187
- "docs": {
188
- "tags": [],
189
- "text": ""
190
- },
191
- "getter": false,
192
- "setter": false
193
- },
194
- "dataMap": {
195
- "type": "unknown",
196
- "mutable": false,
197
- "complexType": {
198
- "original": "Record<string, unknown>",
199
- "resolved": "string | unknown",
200
- "references": {
201
- "Record": {
202
- "location": "global",
203
- "id": "global::Record"
204
- }
205
- }
206
- },
207
- "required": false,
208
- "optional": true,
209
- "docs": {
210
- "tags": [],
211
- "text": ""
212
- },
213
- "getter": false,
214
- "setter": false
215
- },
216
- "locale": {
217
- "type": "string",
218
- "mutable": false,
219
- "complexType": {
220
- "original": "string",
221
- "resolved": "string",
222
- "references": {}
223
- },
224
- "required": false,
225
- "optional": true,
226
- "docs": {
227
- "tags": [],
228
- "text": ""
229
- },
230
- "getter": false,
231
- "setter": false,
232
- "reflect": false,
233
- "attribute": "locale"
234
- }
235
- };
236
- }
237
- static get states() {
238
- return {
239
- "active": {}
240
- };
241
- }
242
- static get events() {
243
- return [{
244
- "method": "stepTouch",
245
- "name": "stepTouch",
246
- "bubbles": true,
247
- "cancelable": true,
248
- "composed": true,
249
- "docs": {
250
- "tags": [],
251
- "text": ""
252
- },
253
- "complexType": {
254
- "original": "{ keys: string[] }",
255
- "resolved": "{ keys: string[]; }",
256
- "references": {}
257
- }
258
- }, {
259
- "method": "stepperSubmit",
260
- "name": "stepperSubmit",
261
- "bubbles": true,
262
- "cancelable": true,
263
- "composed": true,
264
- "docs": {
265
- "tags": [],
266
- "text": ""
267
- },
268
- "complexType": {
269
- "original": "void",
270
- "resolved": "void",
271
- "references": {}
272
- }
273
- }];
274
- }
275
- static get elementRef() { return "host"; }
276
- static get watchers() {
277
- return [{
278
- "propName": "stepLabels",
279
- "methodName": "clampActive"
280
- }];
281
- }
282
- }
@@ -1,38 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-tabs {
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--fk-spacing);
9
- }
10
-
11
- .fk-tabs__nav {
12
- display: flex;
13
- flex-wrap: wrap;
14
- gap: 2px;
15
- border-bottom: 1px solid var(--fk-color-border);
16
- }
17
-
18
- .fk-tabs__tab {
19
- font: inherit;
20
- font-size: 0.85rem;
21
- font-weight: 500;
22
- padding: calc(var(--fk-spacing) / 1.5) var(--fk-spacing);
23
- border: none;
24
- border-bottom: 2px solid transparent;
25
- background: transparent;
26
- color: var(--fk-color-muted);
27
- cursor: pointer;
28
- }
29
-
30
- .fk-tabs__tab:hover {
31
- color: var(--fk-color-text);
32
- }
33
-
34
- .fk-tabs__tab--active {
35
- color: var(--fk-color-primary);
36
- border-bottom-color: var(--fk-color-primary);
37
- font-weight: 600;
38
- }
@@ -1,236 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { iterateSchemaBricks, validateBrickSpecDataDetailed, } from "@streamline-pulse/formkrafter-core";
3
- export class FkTabs {
4
- constructor() {
5
- this.tabLabels = [];
6
- this.editable = false;
7
- this.active = 0;
8
- }
9
- clampActive() {
10
- if (this.active > Math.max(this.tabLabels.length - 1, 0)) {
11
- this.active = 0;
12
- }
13
- }
14
- componentDidRender() {
15
- const body = this.host.querySelector('.fk-tabs__body');
16
- if (!body)
17
- return;
18
- Array.from(body.children).forEach((child, index) => {
19
- const element = child;
20
- if (this.editable)
21
- element.style.removeProperty('display');
22
- else
23
- element.style.display = index === this.active ? '' : 'none';
24
- });
25
- }
26
- validateTabs() {
27
- var _a, _b;
28
- return ((_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.configs) === null || _b === void 0 ? void 0 : _b.validateTabs) === true;
29
- }
30
- tabSpec(index) {
31
- var _a, _b, _c;
32
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
33
- if (!child || !this.spec)
34
- return undefined;
35
- if (((_c = this.tabCache) === null || _c === void 0 ? void 0 : _c.source) !== this.spec) {
36
- this.tabCache = { source: this.spec, specs: [] };
37
- }
38
- if (!this.tabCache.specs[index]) {
39
- this.tabCache.specs[index] = {
40
- type: 'panel',
41
- id: 'tab',
42
- name: 'Tab',
43
- configs: { key: `tab_${index}` },
44
- children: [child],
45
- };
46
- }
47
- return this.tabCache.specs[index];
48
- }
49
- tabKeys(index) {
50
- var _a, _b, _c;
51
- const child = (_b = (_a = this.spec) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[index];
52
- if (!child)
53
- return [];
54
- const keys = [];
55
- for (const brick of iterateSchemaBricks(child)) {
56
- if ((_c = brick.configs) === null || _c === void 0 ? void 0 : _c.key)
57
- keys.push(brick.configs.key);
58
- }
59
- return keys;
60
- }
61
- tabValid(index) {
62
- var _a;
63
- const tabSpec = this.tabSpec(index);
64
- if (!tabSpec)
65
- return true;
66
- const present = Object.fromEntries(Object.entries((_a = this.dataMap) !== null && _a !== void 0 ? _a : {}).filter(([, value]) => value !== '' && value !== null && value !== undefined));
67
- return validateBrickSpecDataDetailed(tabSpec, present, this.locale).valid;
68
- }
69
- goToTab(index) {
70
- if (index === this.active)
71
- return;
72
- if (!this.editable && this.validateTabs() && !this.tabValid(this.active)) {
73
- this.stepTouch.emit({ keys: this.tabKeys(this.active) });
74
- return;
75
- }
76
- this.active = index;
77
- }
78
- render() {
79
- return (h("div", { key: 'dc3d42e16d4dd2c948b780326d13afce15bbd908', class: "fk-tabs" }, h("div", { key: 'a5cfd97f5decd63774b9054559f392c5c23447cc', class: "fk-tabs__nav", role: "tablist" }, this.tabLabels.map((label, index) => (h("button", { key: `${index}-${label}`, type: "button", role: "tab", class: {
80
- 'fk-tabs__tab': true,
81
- 'fk-tabs__tab--active': index === this.active,
82
- }, onClick: (event) => {
83
- event.preventDefault();
84
- this.goToTab(index);
85
- } }, label)))), h("div", { key: 'cd2b57a56aac0d14de856ea004feb3ac55ee8bfa', class: "fk-tabs__body" }, h("slot", { key: 'b4e2b21e39d445465ddf24dd35749efd79fda9c2' }))));
86
- }
87
- static get is() { return "fk-tabs"; }
88
- static get encapsulation() { return "scoped"; }
89
- static get originalStyleUrls() {
90
- return {
91
- "$": ["fk-tabs.css"]
92
- };
93
- }
94
- static get styleUrls() {
95
- return {
96
- "$": ["fk-tabs.css"]
97
- };
98
- }
99
- static get properties() {
100
- return {
101
- "tabLabels": {
102
- "type": "unknown",
103
- "mutable": false,
104
- "complexType": {
105
- "original": "string[]",
106
- "resolved": "string[]",
107
- "references": {}
108
- },
109
- "required": false,
110
- "optional": false,
111
- "docs": {
112
- "tags": [],
113
- "text": ""
114
- },
115
- "getter": false,
116
- "setter": false,
117
- "defaultValue": "[]"
118
- },
119
- "editable": {
120
- "type": "boolean",
121
- "mutable": false,
122
- "complexType": {
123
- "original": "boolean",
124
- "resolved": "boolean",
125
- "references": {}
126
- },
127
- "required": false,
128
- "optional": false,
129
- "docs": {
130
- "tags": [],
131
- "text": ""
132
- },
133
- "getter": false,
134
- "setter": false,
135
- "reflect": false,
136
- "attribute": "editable",
137
- "defaultValue": "false"
138
- },
139
- "spec": {
140
- "type": "unknown",
141
- "mutable": false,
142
- "complexType": {
143
- "original": "BrickSpec",
144
- "resolved": "BrickSpec",
145
- "references": {
146
- "BrickSpec": {
147
- "location": "import",
148
- "path": "@streamline-pulse/formkrafter-core",
149
- "id": "../core/dist/index.d.ts::BrickSpec",
150
- "referenceLocation": "BrickSpec"
151
- }
152
- }
153
- },
154
- "required": false,
155
- "optional": true,
156
- "docs": {
157
- "tags": [],
158
- "text": ""
159
- },
160
- "getter": false,
161
- "setter": false
162
- },
163
- "dataMap": {
164
- "type": "unknown",
165
- "mutable": false,
166
- "complexType": {
167
- "original": "Record<string, unknown>",
168
- "resolved": "string | unknown",
169
- "references": {
170
- "Record": {
171
- "location": "global",
172
- "id": "global::Record"
173
- }
174
- }
175
- },
176
- "required": false,
177
- "optional": true,
178
- "docs": {
179
- "tags": [],
180
- "text": ""
181
- },
182
- "getter": false,
183
- "setter": false
184
- },
185
- "locale": {
186
- "type": "string",
187
- "mutable": false,
188
- "complexType": {
189
- "original": "string",
190
- "resolved": "string",
191
- "references": {}
192
- },
193
- "required": false,
194
- "optional": true,
195
- "docs": {
196
- "tags": [],
197
- "text": ""
198
- },
199
- "getter": false,
200
- "setter": false,
201
- "reflect": false,
202
- "attribute": "locale"
203
- }
204
- };
205
- }
206
- static get states() {
207
- return {
208
- "active": {}
209
- };
210
- }
211
- static get events() {
212
- return [{
213
- "method": "stepTouch",
214
- "name": "stepTouch",
215
- "bubbles": true,
216
- "cancelable": true,
217
- "composed": true,
218
- "docs": {
219
- "tags": [],
220
- "text": ""
221
- },
222
- "complexType": {
223
- "original": "{ keys: string[] }",
224
- "resolved": "{ keys: string[]; }",
225
- "references": {}
226
- }
227
- }];
228
- }
229
- static get elementRef() { return "host"; }
230
- static get watchers() {
231
- return [{
232
- "propName": "tabLabels",
233
- "methodName": "clampActive"
234
- }];
235
- }
236
- }