@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,356 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { evalBrickCode, services } from "@streamline-pulse/formkrafter-core";
3
- import { normalizeOptions } from "../../utils/options";
4
- import { appendSearchParam, interpolateTemplate, parseHeaderLines, } from "../../utils/remote";
5
- import { fkT } from "../../i18n/i18n";
6
- export class FkSelectInput {
7
- constructor() {
8
- this.disabled = false;
9
- this.multiple = false;
10
- this.open = false;
11
- this.query = '';
12
- this.remoteOptions = [];
13
- this.outsideClick = (event) => {
14
- if (!this.host.contains(event.target))
15
- this.close();
16
- };
17
- }
18
- componentWillLoad() {
19
- return this.resolveRemote();
20
- }
21
- disconnectedCallback() {
22
- this.unbindOutsideClick();
23
- }
24
- onConfigsChange() {
25
- this.resolveRemote();
26
- }
27
- onDataMapChange() {
28
- this.resolveRemote();
29
- }
30
- searchParam() {
31
- var _a;
32
- return ((_a = this.configs) === null || _a === void 0 ? void 0 : _a.searchParam) || undefined;
33
- }
34
- remoteUrl() {
35
- var _a;
36
- const raw = (_a = this.configs) === null || _a === void 0 ? void 0 : _a.optionsUrl;
37
- if (!raw)
38
- return undefined;
39
- let url = interpolateTemplate(raw, this.dataMap);
40
- const param = this.searchParam();
41
- if (param)
42
- url = appendSearchParam(url, param, this.query.trim());
43
- return url;
44
- }
45
- bindOutsideClick() {
46
- document.addEventListener('mousedown', this.outsideClick);
47
- }
48
- unbindOutsideClick() {
49
- document.removeEventListener('mousedown', this.outsideClick);
50
- }
51
- toggleOpen() {
52
- if (this.disabled)
53
- return;
54
- if (this.open)
55
- this.close();
56
- else {
57
- this.open = true;
58
- this.query = '';
59
- this.bindOutsideClick();
60
- }
61
- }
62
- close() {
63
- this.open = false;
64
- this.unbindOutsideClick();
65
- }
66
- source() {
67
- var _a, _b;
68
- return (_b = (_a = this.configs) === null || _a === void 0 ? void 0 : _a.optionsSource) !== null && _b !== void 0 ? _b : 'static';
69
- }
70
- async resolveRemote(force = false) {
71
- var _a;
72
- if (this.source() !== 'remote')
73
- return;
74
- const url = this.remoteUrl();
75
- if (!url) {
76
- this.remoteOptions = [];
77
- return;
78
- }
79
- const headers = parseHeaderLines((_a = this.configs) === null || _a === void 0 ? void 0 : _a.optionsHeaders, this.dataMap);
80
- const signature = `${url}|${JSON.stringify(headers !== null && headers !== void 0 ? headers : {})}`;
81
- if (!force && signature === this.lastRemoteSignature)
82
- return;
83
- this.lastRemoteSignature = signature;
84
- try {
85
- this.remoteError = undefined;
86
- this.remoteOptions = await services.dataSourceService.fetchOptions(url, headers ? { headers } : undefined);
87
- }
88
- catch (error) {
89
- this.remoteOptions = [];
90
- this.remoteError = error instanceof Error ? error.message : String(error);
91
- }
92
- }
93
- onSearchInput(value) {
94
- this.query = value;
95
- if (this.source() !== 'remote' || !this.searchParam())
96
- return;
97
- if (this.searchTimer)
98
- clearTimeout(this.searchTimer);
99
- this.searchTimer = setTimeout(() => this.resolveRemote(), 250);
100
- }
101
- resolve() {
102
- var _a, _b, _c, _d, _e, _f;
103
- const labelKey = ((_a = this.configs) === null || _a === void 0 ? void 0 : _a.labelKey) || undefined;
104
- const valueKey = ((_b = this.configs) === null || _b === void 0 ? void 0 : _b.valueKey) || undefined;
105
- switch (this.source()) {
106
- case 'remote':
107
- return {
108
- options: normalizeOptions(this.remoteOptions, labelKey, valueKey),
109
- error: this.remoteError,
110
- };
111
- case 'dataMap': {
112
- const path = (_c = this.configs) === null || _c === void 0 ? void 0 : _c.optionsPath;
113
- return {
114
- options: normalizeOptions(path ? (_d = this.dataMap) === null || _d === void 0 ? void 0 : _d[path] : [], labelKey, valueKey),
115
- };
116
- }
117
- case 'js': {
118
- const code = (_e = this.configs) === null || _e === void 0 ? void 0 : _e.optionsCode;
119
- if (!code)
120
- return { options: [] };
121
- const result = evalBrickCode(code, this.dataMap);
122
- if (result instanceof Error) {
123
- return { options: [], error: result.message };
124
- }
125
- return { options: normalizeOptions(result, labelKey, valueKey) };
126
- }
127
- default:
128
- return {
129
- options: normalizeOptions((_f = this.configs) === null || _f === void 0 ? void 0 : _f.options, labelKey, valueKey),
130
- };
131
- }
132
- }
133
- selectedValues() {
134
- if (this.multiple) {
135
- return Array.isArray(this.value) ? this.value : [];
136
- }
137
- return typeof this.value === 'string' && this.value !== '' ? [this.value] : [];
138
- }
139
- labelOf(value, options) {
140
- var _a, _b;
141
- return (_b = (_a = options.find((option) => option.value === value)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : value;
142
- }
143
- pick(option) {
144
- if (this.multiple) {
145
- const selected = this.selectedValues();
146
- const next = selected.includes(option.value)
147
- ? selected.filter((value) => value !== option.value)
148
- : [...selected, option.value];
149
- this.selectValueChange.emit(next.length ? next : undefined);
150
- return;
151
- }
152
- this.selectValueChange.emit(option.value);
153
- this.close();
154
- }
155
- unpick(value) {
156
- const next = this.selectedValues().filter((entry) => entry !== value);
157
- this.selectValueChange.emit(next.length ? next : undefined);
158
- }
159
- filteredOptions(options) {
160
- if (this.source() === 'remote' && this.searchParam())
161
- return options;
162
- const query = this.query.trim().toLowerCase();
163
- if (!query)
164
- return options;
165
- return options.filter((option) => option.label.toLowerCase().includes(query));
166
- }
167
- render() {
168
- var _a, _b;
169
- const { options, error } = this.resolve();
170
- const selected = this.selectedValues();
171
- const filtered = this.filteredOptions(options);
172
- return (h("div", { key: '85d53f13df0d06af139fd666e2c81c1cae51080a', class: { 'fk-select': true, 'fk-select--disabled': this.disabled } }, h("div", { key: '2b91528a8584a4437b4a4d873276feb8a5126b1e', class: { 'fk-select__trigger': true, 'fk-select__trigger--open': this.open }, onClick: (event) => {
173
- event.preventDefault();
174
- this.toggleOpen();
175
- } }, h("div", { key: 'bc0dafdb3b3aec4ad2f90fc57a59cae953dc5f16', class: "fk-select__values" }, selected.length === 0 ? (h("span", { class: "fk-select__placeholder" }, String((_b = (_a = this.configs) === null || _a === void 0 ? void 0 : _a.placeholder) !== null && _b !== void 0 ? _b : ''))) : this.multiple ? (selected.map((value) => (h("span", { class: "fk-select__chip", key: value }, this.labelOf(value, options), h("button", { type: "button", class: "fk-select__chip-remove", disabled: this.disabled, onClick: (event) => {
176
- event.preventDefault();
177
- event.stopPropagation();
178
- this.unpick(value);
179
- } }, "\u2715"))))) : (h("span", { class: "fk-select__value" }, this.labelOf(selected[0], options)))), !this.multiple && selected.length > 0 && !this.disabled ? (h("button", { type: "button", class: "fk-select__clear", title: fkT('select.clear'), onClick: (event) => {
180
- event.preventDefault();
181
- event.stopPropagation();
182
- this.selectValueChange.emit(undefined);
183
- } }, "\u2715")) : null, h("span", { key: '4b254a05b0a0f92171fc4ead179f407f5dbe0fd1', class: "fk-select__caret" }, "\u25BE")), this.open ? (h("div", { class: "fk-select__dropdown" }, h("input", { class: "fk-select__search", type: "text", placeholder: fkT('select.search'), value: this.query, ref: (element) => setTimeout(() => element === null || element === void 0 ? void 0 : element.focus(), 0), onInput: (event) => this.onSearchInput(event.target.value), onKeyDown: (event) => {
184
- if (event.key === 'Escape')
185
- this.close();
186
- if (event.key === 'Enter' && filtered.length > 0) {
187
- event.preventDefault();
188
- this.pick(filtered[0]);
189
- }
190
- } }), h("div", { class: "fk-select__options", role: "listbox" }, filtered.map((option) => {
191
- const isSelected = selected.includes(option.value);
192
- return (h("div", { key: option.value, role: "option", "aria-selected": isSelected ? 'true' : 'false', class: {
193
- 'fk-select__option': true,
194
- 'fk-select__option--selected': isSelected,
195
- }, onClick: (event) => {
196
- event.preventDefault();
197
- this.pick(option);
198
- } }, h("span", { class: "fk-select__option-label" }, option.label), isSelected ? h("span", { class: "fk-select__check" }, "\u2713") : null));
199
- }), filtered.length === 0 ? (h("p", { class: "fk-select__empty" }, fkT('select.empty'))) : null))) : null, error ? h("span", { class: "fk-field__error" }, error) : null));
200
- }
201
- static get is() { return "fk-select-input"; }
202
- static get encapsulation() { return "scoped"; }
203
- static get originalStyleUrls() {
204
- return {
205
- "$": ["fk-select-input.css"]
206
- };
207
- }
208
- static get styleUrls() {
209
- return {
210
- "$": ["fk-select-input.css"]
211
- };
212
- }
213
- static get properties() {
214
- return {
215
- "configs": {
216
- "type": "unknown",
217
- "mutable": false,
218
- "complexType": {
219
- "original": "Record<string, unknown>",
220
- "resolved": "string | unknown",
221
- "references": {
222
- "Record": {
223
- "location": "global",
224
- "id": "global::Record"
225
- }
226
- }
227
- },
228
- "required": false,
229
- "optional": true,
230
- "docs": {
231
- "tags": [],
232
- "text": ""
233
- },
234
- "getter": false,
235
- "setter": false
236
- },
237
- "value": {
238
- "type": "string",
239
- "mutable": false,
240
- "complexType": {
241
- "original": "string | string[]",
242
- "resolved": "string | string[]",
243
- "references": {}
244
- },
245
- "required": false,
246
- "optional": true,
247
- "docs": {
248
- "tags": [],
249
- "text": ""
250
- },
251
- "getter": false,
252
- "setter": false,
253
- "reflect": false,
254
- "attribute": "value"
255
- },
256
- "disabled": {
257
- "type": "boolean",
258
- "mutable": false,
259
- "complexType": {
260
- "original": "boolean",
261
- "resolved": "boolean",
262
- "references": {}
263
- },
264
- "required": false,
265
- "optional": false,
266
- "docs": {
267
- "tags": [],
268
- "text": ""
269
- },
270
- "getter": false,
271
- "setter": false,
272
- "reflect": false,
273
- "attribute": "disabled",
274
- "defaultValue": "false"
275
- },
276
- "multiple": {
277
- "type": "boolean",
278
- "mutable": false,
279
- "complexType": {
280
- "original": "boolean",
281
- "resolved": "boolean",
282
- "references": {}
283
- },
284
- "required": false,
285
- "optional": false,
286
- "docs": {
287
- "tags": [],
288
- "text": ""
289
- },
290
- "getter": false,
291
- "setter": false,
292
- "reflect": false,
293
- "attribute": "multiple",
294
- "defaultValue": "false"
295
- },
296
- "dataMap": {
297
- "type": "unknown",
298
- "mutable": false,
299
- "complexType": {
300
- "original": "Record<string, unknown>",
301
- "resolved": "string | unknown",
302
- "references": {
303
- "Record": {
304
- "location": "global",
305
- "id": "global::Record"
306
- }
307
- }
308
- },
309
- "required": false,
310
- "optional": true,
311
- "docs": {
312
- "tags": [],
313
- "text": ""
314
- },
315
- "getter": false,
316
- "setter": false
317
- }
318
- };
319
- }
320
- static get states() {
321
- return {
322
- "open": {},
323
- "query": {},
324
- "remoteOptions": {},
325
- "remoteError": {}
326
- };
327
- }
328
- static get events() {
329
- return [{
330
- "method": "selectValueChange",
331
- "name": "selectValueChange",
332
- "bubbles": true,
333
- "cancelable": true,
334
- "composed": true,
335
- "docs": {
336
- "tags": [],
337
- "text": ""
338
- },
339
- "complexType": {
340
- "original": "string | string[] | undefined",
341
- "resolved": "string | string[]",
342
- "references": {}
343
- }
344
- }];
345
- }
346
- static get elementRef() { return "host"; }
347
- static get watchers() {
348
- return [{
349
- "propName": "configs",
350
- "methodName": "onConfigsChange"
351
- }, {
352
- "propName": "dataMap",
353
- "methodName": "onDataMapChange"
354
- }];
355
- }
356
- }
@@ -1,42 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-signature {
6
- display: flex;
7
- flex-direction: column;
8
- gap: calc(var(--fk-spacing) / 2);
9
- align-items: flex-start;
10
- }
11
-
12
- .fk-signature__canvas {
13
- width: 100%;
14
- max-width: 480px;
15
- border: 1px dashed var(--fk-color-border);
16
- border-radius: var(--fk-radius);
17
- background: var(--fk-color-surface);
18
- color: var(--fk-color-text);
19
- touch-action: none;
20
- cursor: crosshair;
21
- }
22
-
23
- .fk-signature--disabled .fk-signature__canvas {
24
- cursor: not-allowed;
25
- opacity: 0.6;
26
- }
27
-
28
- .fk-signature__clear {
29
- font: inherit;
30
- font-size: 0.75rem;
31
- padding: 3px 10px;
32
- border: 1px solid var(--fk-color-border);
33
- border-radius: calc(var(--fk-radius) / 2);
34
- background: transparent;
35
- color: var(--fk-color-muted);
36
- cursor: pointer;
37
- }
38
-
39
- .fk-signature__clear:hover:not(:disabled) {
40
- color: var(--fk-color-danger);
41
- border-color: var(--fk-color-danger);
42
- }
@@ -1,158 +0,0 @@
1
- import { h } from "@stencil/core";
2
- import { fkT } from "../../i18n/i18n";
3
- export class FkSignatureInput {
4
- constructor() {
5
- this.disabled = false;
6
- this.drawing = false;
7
- this.start = (event) => {
8
- if (this.disabled || !this.canvas)
9
- return;
10
- this.drawing = true;
11
- this.canvas.setPointerCapture(event.pointerId);
12
- const ctx = this.context();
13
- if (!ctx)
14
- return;
15
- ctx.lineWidth = 2;
16
- ctx.lineCap = 'round';
17
- ctx.strokeStyle = getComputedStyle(this.canvas).color;
18
- ctx.beginPath();
19
- ctx.moveTo(...this.position(event));
20
- };
21
- this.move = (event) => {
22
- if (!this.drawing)
23
- return;
24
- const ctx = this.context();
25
- if (!ctx)
26
- return;
27
- ctx.lineTo(...this.position(event));
28
- ctx.stroke();
29
- };
30
- this.end = () => {
31
- if (!this.drawing || !this.canvas)
32
- return;
33
- this.drawing = false;
34
- this.lastEmitted = this.canvas.toDataURL('image/png');
35
- this.signatureChange.emit(this.lastEmitted);
36
- };
37
- this.clear = () => {
38
- const ctx = this.context();
39
- if (!ctx || !this.canvas)
40
- return;
41
- ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
42
- this.lastEmitted = undefined;
43
- this.signatureChange.emit(undefined);
44
- };
45
- }
46
- componentDidLoad() {
47
- this.restore();
48
- }
49
- onValueChange(next) {
50
- if (next === this.lastEmitted)
51
- return;
52
- this.restore();
53
- }
54
- context() {
55
- var _a, _b;
56
- return (_b = (_a = this.canvas) === null || _a === void 0 ? void 0 : _a.getContext('2d')) !== null && _b !== void 0 ? _b : undefined;
57
- }
58
- restore() {
59
- const ctx = this.context();
60
- if (!ctx || !this.canvas)
61
- return;
62
- ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
63
- if (!this.value)
64
- return;
65
- const image = new Image();
66
- image.onload = () => ctx.drawImage(image, 0, 0);
67
- image.src = this.value;
68
- }
69
- position(event) {
70
- const rect = this.canvas.getBoundingClientRect();
71
- return [
72
- ((event.clientX - rect.left) * this.canvas.width) / rect.width,
73
- ((event.clientY - rect.top) * this.canvas.height) / rect.height,
74
- ];
75
- }
76
- render() {
77
- return (h("div", { key: 'e81687b01b30d71794b09cae1eb2215cc10a894f', class: { 'fk-signature': true, 'fk-signature--disabled': this.disabled } }, h("canvas", { key: '9a1031b1c89ee5c9d3ab465b06433125eaa7ee8c', class: "fk-signature__canvas", width: 480, height: 140, ref: (element) => (this.canvas = element), onPointerDown: this.start, onPointerMove: this.move, onPointerUp: this.end, onPointerLeave: this.end }), h("button", { key: '09e36234ffbd7367b65596a1eadf3cb019aeedad', type: "button", class: "fk-signature__clear", disabled: this.disabled, onClick: this.clear }, fkT('signature.clear'))));
78
- }
79
- static get is() { return "fk-signature-input"; }
80
- static get encapsulation() { return "scoped"; }
81
- static get originalStyleUrls() {
82
- return {
83
- "$": ["fk-signature-input.css"]
84
- };
85
- }
86
- static get styleUrls() {
87
- return {
88
- "$": ["fk-signature-input.css"]
89
- };
90
- }
91
- static get properties() {
92
- return {
93
- "value": {
94
- "type": "string",
95
- "mutable": false,
96
- "complexType": {
97
- "original": "string",
98
- "resolved": "string",
99
- "references": {}
100
- },
101
- "required": false,
102
- "optional": true,
103
- "docs": {
104
- "tags": [],
105
- "text": ""
106
- },
107
- "getter": false,
108
- "setter": false,
109
- "reflect": false,
110
- "attribute": "value"
111
- },
112
- "disabled": {
113
- "type": "boolean",
114
- "mutable": false,
115
- "complexType": {
116
- "original": "boolean",
117
- "resolved": "boolean",
118
- "references": {}
119
- },
120
- "required": false,
121
- "optional": false,
122
- "docs": {
123
- "tags": [],
124
- "text": ""
125
- },
126
- "getter": false,
127
- "setter": false,
128
- "reflect": false,
129
- "attribute": "disabled",
130
- "defaultValue": "false"
131
- }
132
- };
133
- }
134
- static get events() {
135
- return [{
136
- "method": "signatureChange",
137
- "name": "signatureChange",
138
- "bubbles": true,
139
- "cancelable": true,
140
- "composed": true,
141
- "docs": {
142
- "tags": [],
143
- "text": ""
144
- },
145
- "complexType": {
146
- "original": "string | undefined",
147
- "resolved": "string",
148
- "references": {}
149
- }
150
- }];
151
- }
152
- static get watchers() {
153
- return [{
154
- "propName": "value",
155
- "methodName": "onValueChange"
156
- }];
157
- }
158
- }
@@ -1,85 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .fk-stepper {
6
- display: flex;
7
- flex-direction: column;
8
- gap: var(--fk-spacing);
9
- }
10
-
11
- .fk-stepper__nav {
12
- display: flex;
13
- flex-wrap: wrap;
14
- gap: calc(var(--fk-spacing) * 1.5);
15
- margin: 0;
16
- padding: 0 0 var(--fk-spacing);
17
- list-style: none;
18
- border-bottom: 1px solid var(--fk-color-border);
19
- }
20
-
21
- .fk-stepper__step {
22
- display: flex;
23
- align-items: center;
24
- gap: calc(var(--fk-spacing) / 2);
25
- cursor: pointer;
26
- color: var(--fk-color-muted);
27
- font-size: 0.85rem;
28
- }
29
-
30
- .fk-stepper__index {
31
- display: inline-flex;
32
- align-items: center;
33
- justify-content: center;
34
- width: 22px;
35
- height: 22px;
36
- border-radius: 50%;
37
- border: 1px solid var(--fk-color-border);
38
- font-size: 0.72rem;
39
- font-weight: 700;
40
- }
41
-
42
- .fk-stepper__step--active {
43
- color: var(--fk-color-text);
44
- font-weight: 600;
45
- }
46
-
47
- .fk-stepper__step--active .fk-stepper__index {
48
- border-color: var(--fk-color-primary);
49
- background: var(--fk-color-primary);
50
- color: #ffffff;
51
- }
52
-
53
- .fk-stepper__step--done .fk-stepper__index {
54
- border-color: var(--fk-color-primary);
55
- color: var(--fk-color-primary);
56
- }
57
-
58
- .fk-stepper__actions {
59
- display: flex;
60
- justify-content: space-between;
61
- padding-top: var(--fk-spacing);
62
- border-top: 1px solid var(--fk-color-border);
63
- }
64
-
65
- .fk-stepper__button {
66
- font: inherit;
67
- font-size: 0.85rem;
68
- padding: calc(var(--fk-spacing) / 1.5) calc(var(--fk-spacing) * 1.5);
69
- border: 1px solid var(--fk-color-border);
70
- border-radius: var(--fk-radius);
71
- background: var(--fk-color-surface);
72
- color: var(--fk-color-text);
73
- cursor: pointer;
74
- }
75
-
76
- .fk-stepper__button--primary {
77
- border-color: var(--fk-color-primary);
78
- background: var(--fk-color-primary);
79
- color: #ffffff;
80
- }
81
-
82
- .fk-stepper__button:disabled {
83
- opacity: 0.45;
84
- cursor: not-allowed;
85
- }