@everymatrix/lottery-selection 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-9b8fe4ee.js +1215 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/lottery-selection-3122c2e3.js +214 -0
- package/dist/cjs/lottery-selection.cjs.entry.js +10 -0
- package/dist/cjs/lottery-selection.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/lottery-selection/index.js +1 -0
- package/dist/collection/components/lottery-selection/lottery-selection.css +64 -0
- package/dist/collection/components/lottery-selection/lottery-selection.js +342 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/utils.js +11 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-ab825ca6.js +1188 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/lottery-selection-75fcc811.js +212 -0
- package/dist/esm/lottery-selection.entry.js +2 -0
- package/dist/esm/lottery-selection.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/lottery-selection/app-globals-0f993ce5.js +1 -0
- package/dist/lottery-selection/index-ab825ca6.js +2 -0
- package/dist/lottery-selection/index.esm.js +1 -0
- package/dist/lottery-selection/lottery-selection-75fcc811.js +1 -0
- package/dist/lottery-selection/lottery-selection.entry.js +1 -0
- package/dist/lottery-selection/lottery-selection.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/packages/stencil/lottery-selection/stencil.config.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/packages/stencil/lottery-selection/stencil.config.dev.d.ts +2 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/packages/stencil/lottery-selection/storybook/main.d.ts +3 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/packages/stencil/lottery-selection/storybook/preview.d.ts +70 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/tools/plugins/index.d.ts +4 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/lottery-selection/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/lottery-selection/index.d.ts +1 -0
- package/dist/types/components/lottery-selection/lottery-selection.d.ts +68 -0
- package/dist/types/components.d.ts +149 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
|
|
3
|
+
import { DeleteFilled } from "@ant-design/icons-svg";
|
|
4
|
+
import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
|
|
5
|
+
import { sanitizeSvg } from "../../utils/utils";
|
|
6
|
+
export class LotterySelection {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.value = 0;
|
|
9
|
+
this.text = undefined;
|
|
10
|
+
this.idx = undefined;
|
|
11
|
+
this.type = 'toggle';
|
|
12
|
+
this.mbSource = undefined;
|
|
13
|
+
this.clientStyling = undefined;
|
|
14
|
+
this.clientStylingUrl = undefined;
|
|
15
|
+
this.hasBorder = true;
|
|
16
|
+
this.hasBackground = true;
|
|
17
|
+
this.deleteIconSvg = '';
|
|
18
|
+
this.deleteIconWidth = '16px';
|
|
19
|
+
this.deleteIconHeight = '16px';
|
|
20
|
+
}
|
|
21
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
22
|
+
if (newValue !== oldValue) {
|
|
23
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
27
|
+
if (newValue !== oldValue) {
|
|
28
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
32
|
+
if (newValue !== oldValue) {
|
|
33
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
componentDidLoad() {
|
|
37
|
+
if (this.stylingContainer) {
|
|
38
|
+
if (this.mbSource)
|
|
39
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
40
|
+
if (this.clientStyling)
|
|
41
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
42
|
+
if (this.clientStylingUrl)
|
|
43
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
48
|
+
}
|
|
49
|
+
handleClick() {
|
|
50
|
+
if (this.type === 'disabled' || this.type === 'readonly') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.log('bullet clicked', this.type, this.idx, this.text, this.value);
|
|
54
|
+
this.lotteryBulletClickHandler.emit({
|
|
55
|
+
type: this.type,
|
|
56
|
+
idx: this.idx,
|
|
57
|
+
text: this.text,
|
|
58
|
+
value: this.value
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
let iconToRender;
|
|
63
|
+
if (this.deleteIconSvg) {
|
|
64
|
+
iconToRender = sanitizeSvg(this.deleteIconSvg);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
iconToRender = renderIconDefinitionToSVGElement(DeleteFilled, {
|
|
68
|
+
extraSVGAttrs: {
|
|
69
|
+
width: this.deleteIconWidth,
|
|
70
|
+
height: this.deleteIconHeight,
|
|
71
|
+
fill: 'currentColor'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return (h("div", { key: '0d1e8aaa80a907a7467410f6b27b4b6175e82299', class: "lottery-selection", ref: (el) => (this.stylingContainer = el) }, h("button", { key: '11a2402abbc290dc877ad95f3433092c3a0d8419', class: {
|
|
76
|
+
'lottery-selection__button': true,
|
|
77
|
+
'lottery-selection__button--selected': this.value == 1,
|
|
78
|
+
'lottery-selection__button--disabled': this.type === 'disabled',
|
|
79
|
+
'lottery-selection__button--no-border': !this.hasBorder,
|
|
80
|
+
'lottery-selection__button--no-background': !this.hasBackground,
|
|
81
|
+
isDeleteByIcon: this.type === 'delete',
|
|
82
|
+
isCallDialogBtn: this.type === 'input' || this.type === 'readonly'
|
|
83
|
+
}, onClick: this.handleClick.bind(this), disabled: this.type === 'disabled' }, this.type === 'delete' && h("span", { key: 'f99001d936a8f7bdf8adc5c46e82caf730a9442a', class: "lottery-selection__delete-icon", innerHTML: iconToRender }), h("span", { key: '55775e2492a1fe45cc8a457ac0a0d206744461ab', class: "lottery-selection__text" }, this.text))));
|
|
84
|
+
}
|
|
85
|
+
static get is() { return "lottery-selection"; }
|
|
86
|
+
static get encapsulation() { return "shadow"; }
|
|
87
|
+
static get originalStyleUrls() {
|
|
88
|
+
return {
|
|
89
|
+
"$": ["lottery-selection.scss"]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
static get styleUrls() {
|
|
93
|
+
return {
|
|
94
|
+
"$": ["lottery-selection.css"]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
static get properties() {
|
|
98
|
+
return {
|
|
99
|
+
"value": {
|
|
100
|
+
"type": "any",
|
|
101
|
+
"mutable": false,
|
|
102
|
+
"complexType": {
|
|
103
|
+
"original": "number | string",
|
|
104
|
+
"resolved": "number | string",
|
|
105
|
+
"references": {}
|
|
106
|
+
},
|
|
107
|
+
"required": false,
|
|
108
|
+
"optional": false,
|
|
109
|
+
"docs": {
|
|
110
|
+
"tags": [],
|
|
111
|
+
"text": "The current value of the selection.\nCan be 0 (unselected) or 1 (selected), or a string value."
|
|
112
|
+
},
|
|
113
|
+
"attribute": "value",
|
|
114
|
+
"reflect": true,
|
|
115
|
+
"defaultValue": "0"
|
|
116
|
+
},
|
|
117
|
+
"text": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "string",
|
|
122
|
+
"resolved": "string",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": "The text label displayed inside the button."
|
|
130
|
+
},
|
|
131
|
+
"attribute": "text",
|
|
132
|
+
"reflect": true
|
|
133
|
+
},
|
|
134
|
+
"idx": {
|
|
135
|
+
"type": "number",
|
|
136
|
+
"mutable": false,
|
|
137
|
+
"complexType": {
|
|
138
|
+
"original": "number",
|
|
139
|
+
"resolved": "number",
|
|
140
|
+
"references": {}
|
|
141
|
+
},
|
|
142
|
+
"required": false,
|
|
143
|
+
"optional": false,
|
|
144
|
+
"docs": {
|
|
145
|
+
"tags": [],
|
|
146
|
+
"text": "The index of this selection item, useful for identification in lists."
|
|
147
|
+
},
|
|
148
|
+
"attribute": "idx",
|
|
149
|
+
"reflect": true
|
|
150
|
+
},
|
|
151
|
+
"type": {
|
|
152
|
+
"type": "string",
|
|
153
|
+
"mutable": false,
|
|
154
|
+
"complexType": {
|
|
155
|
+
"original": "'toggle' | 'delete' | 'input' | 'readonly' | 'disabled'",
|
|
156
|
+
"resolved": "\"delete\" | \"disabled\" | \"input\" | \"readonly\" | \"toggle\"",
|
|
157
|
+
"references": {}
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"optional": false,
|
|
161
|
+
"docs": {
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": "The type of the selection button which determines its behavior and appearance.\nPossible values: 'toggle', 'delete', 'input', 'readonly', 'disabled'.\nDefaults to 'toggle'."
|
|
164
|
+
},
|
|
165
|
+
"attribute": "type",
|
|
166
|
+
"reflect": true,
|
|
167
|
+
"defaultValue": "'toggle'"
|
|
168
|
+
},
|
|
169
|
+
"mbSource": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "Client custom styling via message bus source identifier."
|
|
182
|
+
},
|
|
183
|
+
"attribute": "mb-source",
|
|
184
|
+
"reflect": true
|
|
185
|
+
},
|
|
186
|
+
"clientStyling": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"mutable": false,
|
|
189
|
+
"complexType": {
|
|
190
|
+
"original": "string",
|
|
191
|
+
"resolved": "string",
|
|
192
|
+
"references": {}
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"docs": {
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": "Client custom styling via raw CSS string."
|
|
199
|
+
},
|
|
200
|
+
"attribute": "client-styling",
|
|
201
|
+
"reflect": true
|
|
202
|
+
},
|
|
203
|
+
"clientStylingUrl": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "string",
|
|
208
|
+
"resolved": "string",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "Client custom styling via CSS file URL."
|
|
216
|
+
},
|
|
217
|
+
"attribute": "client-styling-url",
|
|
218
|
+
"reflect": true
|
|
219
|
+
},
|
|
220
|
+
"hasBorder": {
|
|
221
|
+
"type": "boolean",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "boolean",
|
|
225
|
+
"resolved": "boolean",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": "Whether the button has a border. Defaults to true."
|
|
233
|
+
},
|
|
234
|
+
"attribute": "has-border",
|
|
235
|
+
"reflect": true,
|
|
236
|
+
"defaultValue": "true"
|
|
237
|
+
},
|
|
238
|
+
"hasBackground": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "boolean",
|
|
243
|
+
"resolved": "boolean",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Whether the button has a background color. Defaults to true."
|
|
251
|
+
},
|
|
252
|
+
"attribute": "has-background",
|
|
253
|
+
"reflect": true,
|
|
254
|
+
"defaultValue": "true"
|
|
255
|
+
},
|
|
256
|
+
"deleteIconSvg": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Custom SVG string for the delete icon. If provided, it overrides the default Ant Design delete icon.\n**WARNING**: Directly using `innerHTML` with user-provided content can lead to XSS vulnerabilities.\nEnsure that the `deleteIconSvg` value is sanitized by the consumer of this component before passing it,\nor ensure it comes from a trusted source. This component performs basic sanitization but it is not\na foolproof protection against all possible SVG-based XSS attacks."
|
|
269
|
+
},
|
|
270
|
+
"attribute": "delete-icon-svg",
|
|
271
|
+
"reflect": true,
|
|
272
|
+
"defaultValue": "''"
|
|
273
|
+
},
|
|
274
|
+
"deleteIconWidth": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"mutable": false,
|
|
277
|
+
"complexType": {
|
|
278
|
+
"original": "string",
|
|
279
|
+
"resolved": "string",
|
|
280
|
+
"references": {}
|
|
281
|
+
},
|
|
282
|
+
"required": false,
|
|
283
|
+
"optional": false,
|
|
284
|
+
"docs": {
|
|
285
|
+
"tags": [],
|
|
286
|
+
"text": "Width for the delete icon (applies to default icon if no custom SVG is provided)."
|
|
287
|
+
},
|
|
288
|
+
"attribute": "delete-icon-width",
|
|
289
|
+
"reflect": true,
|
|
290
|
+
"defaultValue": "'16px'"
|
|
291
|
+
},
|
|
292
|
+
"deleteIconHeight": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"mutable": false,
|
|
295
|
+
"complexType": {
|
|
296
|
+
"original": "string",
|
|
297
|
+
"resolved": "string",
|
|
298
|
+
"references": {}
|
|
299
|
+
},
|
|
300
|
+
"required": false,
|
|
301
|
+
"optional": false,
|
|
302
|
+
"docs": {
|
|
303
|
+
"tags": [],
|
|
304
|
+
"text": "Height for the delete icon (applies to default icon if no custom SVG is provided)."
|
|
305
|
+
},
|
|
306
|
+
"attribute": "delete-icon-height",
|
|
307
|
+
"reflect": true,
|
|
308
|
+
"defaultValue": "'16px'"
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
static get events() {
|
|
313
|
+
return [{
|
|
314
|
+
"method": "lotteryBulletClickHandler",
|
|
315
|
+
"name": "lotteryBulletClick",
|
|
316
|
+
"bubbles": true,
|
|
317
|
+
"cancelable": true,
|
|
318
|
+
"composed": true,
|
|
319
|
+
"docs": {
|
|
320
|
+
"tags": [],
|
|
321
|
+
"text": ""
|
|
322
|
+
},
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "any",
|
|
325
|
+
"resolved": "any",
|
|
326
|
+
"references": {}
|
|
327
|
+
}
|
|
328
|
+
}];
|
|
329
|
+
}
|
|
330
|
+
static get watchers() {
|
|
331
|
+
return [{
|
|
332
|
+
"propName": "clientStyling",
|
|
333
|
+
"methodName": "handleClientStylingChange"
|
|
334
|
+
}, {
|
|
335
|
+
"propName": "clientStylingUrl",
|
|
336
|
+
"methodName": "handleClientStylingUrlChange"
|
|
337
|
+
}, {
|
|
338
|
+
"propName": "mbSource",
|
|
339
|
+
"methodName": "handleMbSourceChange"
|
|
340
|
+
}];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/lottery-selection';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function format(first, middle, last) {
|
|
2
|
+
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
3
|
+
}
|
|
4
|
+
// Basic sanitization method for SVG content
|
|
5
|
+
// This is NOT a complete XSS prevention for SVG, but prevents common attacks.
|
|
6
|
+
export function sanitizeSvg(svgString) {
|
|
7
|
+
let sanitized = svgString.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // Remove <script> tags
|
|
8
|
+
sanitized = sanitized.replace(/on[a-z]+=[\"'][^\"']*[\"']/gi, ''); // Remove on* attributes
|
|
9
|
+
sanitized = sanitized.replace(/javascript:/gi, ''); // Remove javascript: URLs
|
|
10
|
+
return sanitized;
|
|
11
|
+
}
|