@shoper/phoenix_design_system 1.2.1 → 1.2.3-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/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js +18 -4
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js +3 -4
- package/build/cjs/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js +67 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file/file_model.js +18 -0
- package/build/cjs/packages/phoenix/src/components/{toggle/toggle_constants.js.map → form/file_picker/file/file_model.js.map} +1 -1
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js +172 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +37 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js +59 -0
- package/build/cjs/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map +1 -0
- package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js +6 -5
- package/build/cjs/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
- package/build/cjs/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
- package/build/cjs/packages/phoenix/src/components/form/select/select.js +25 -88
- package/build/cjs/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js +0 -5
- package/build/cjs/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js +0 -6
- package/build/cjs/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/cjs/packages/phoenix/src/components/modal/modal.js +1 -1
- package/build/cjs/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js +2 -6
- package/build/cjs/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js.map +1 -1
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +3 -16
- package/build/cjs/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/cjs/packages/phoenix/src/index.js +21 -18
- package/build/cjs/packages/phoenix/src/index.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.d.ts +2 -0
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js +18 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.d.ts +0 -1
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js +3 -4
- package/build/esm/packages/phoenix/src/components/dropdown/dropdown_content.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.d.ts +12 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file.js +65 -0
- package/build/esm/packages/phoenix/src/components/{toggle/toggle_button.js.map → form/file_picker/file/file.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.d.ts +9 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file/file_model.js +14 -0
- package/build/esm/{external/lit/external/lit-html/directives/template-content.js.map → packages/phoenix/src/components/form/file_picker/file/file_model.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.d.ts +30 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js +170 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker.js.map +1 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.d.ts +29 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js +29 -0
- package/build/{cjs/external/lit/external/lit-html/directives/template-content.js.map → esm/packages/phoenix/src/components/form/file_picker/file_picker_constants.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.d.ts +13 -0
- package/build/esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js +57 -0
- package/build/{cjs/packages/phoenix/src/components/toggle/toggle_button.js.map → esm/packages/phoenix/src/components/form/file_picker/file_picker_label.js.map} +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.d.ts +1 -2
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js +6 -5
- package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.d.ts +10 -10
- package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.js +13 -13
- package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.d.ts +3 -3
- package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js +6 -6
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.d.ts +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.js +2 -2
- package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controllers_types.d.ts +9 -9
- package/build/esm/packages/phoenix/src/components/form/select/select.d.ts +3 -16
- package/build/esm/packages/phoenix/src/components/form/select/select.js +26 -89
- package/build/esm/packages/phoenix/src/components/form/select/select.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.d.ts +0 -4
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.js +1 -5
- package/build/esm/packages/phoenix/src/components/form/select/select_constants.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.d.ts +0 -2
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js +0 -6
- package/build/esm/packages/phoenix/src/components/form/select/select_utils.js.map +1 -1
- package/build/esm/packages/phoenix/src/components/modal/modal.js +1 -1
- package/build/esm/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js +2 -6
- package/build/esm/packages/phoenix/src/controllers/click_outside_controller/click_outside_controller.js.map +1 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.d.ts +0 -1
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js +3 -16
- package/build/esm/packages/phoenix/src/core/phoenix_light_lit_element/phoenix_light_lit_element.js.map +1 -1
- package/build/esm/packages/phoenix/src/index.d.ts +3 -4
- package/build/esm/packages/phoenix/src/index.js +3 -3
- package/package.json +3 -3
- package/build/cjs/external/lit/external/lit-html/directives/template-content.js +0 -15
- package/build/cjs/packages/phoenix/src/components/toggle/toggle.js +0 -43
- package/build/cjs/packages/phoenix/src/components/toggle/toggle.js.map +0 -1
- package/build/cjs/packages/phoenix/src/components/toggle/toggle_button.js +0 -57
- package/build/cjs/packages/phoenix/src/components/toggle/toggle_constants.js +0 -15
- package/build/esm/external/lit/external/lit-html/directives/template-content.js +0 -11
- package/build/esm/packages/phoenix/src/components/form/select/select_types.d.ts +0 -2
- package/build/esm/packages/phoenix/src/components/form/select/select_types.js +0 -2
- package/build/esm/packages/phoenix/src/components/form/select/select_types.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/toggle/toggle.d.ts +0 -11
- package/build/esm/packages/phoenix/src/components/toggle/toggle.js +0 -41
- package/build/esm/packages/phoenix/src/components/toggle/toggle.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/toggle/toggle_button.d.ts +0 -14
- package/build/esm/packages/phoenix/src/components/toggle/toggle_button.js +0 -55
- package/build/esm/packages/phoenix/src/components/toggle/toggle_constants.d.ts +0 -6
- package/build/esm/packages/phoenix/src/components/toggle/toggle_constants.js +0 -9
- package/build/esm/packages/phoenix/src/components/toggle/toggle_constants.js.map +0 -1
- package/build/esm/packages/phoenix/src/components/toggle/toggle_types.d.ts +0 -3
- package/build/esm/packages/phoenix/src/components/toggle/toggle_types.js +0 -2
- package/build/esm/packages/phoenix/src/components/toggle/toggle_types.js.map +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { ICON_CSS_CLASSES } from '../../../icon/icon_constants.js';
|
|
7
|
+
import { FILE_ITEM_EVENT_NAMES, FILE_ITEM_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES } from '../file_picker_constants.js';
|
|
8
|
+
|
|
9
|
+
let HFile = class HFile extends PhoenixLightLitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this._handleClick = () => {
|
|
13
|
+
const removeItemEvent = new CustomEvent(FILE_ITEM_EVENT_NAMES.removed, {
|
|
14
|
+
bubbles: true
|
|
15
|
+
});
|
|
16
|
+
this.dispatchEvent(removeItemEvent);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
super.connectedCallback();
|
|
21
|
+
this.setAttribute('aria-label', this.name);
|
|
22
|
+
this.classList.add(FILE_ITEM_CSS_CLASSES.file);
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
<span class="${FILE_ITEM_CSS_CLASSES.fileName}">${this.name}</span>
|
|
27
|
+
<button
|
|
28
|
+
class="${FILE_ITEM_CSS_CLASSES.fileRemoveButton}"
|
|
29
|
+
@click="${this._handleClick}"
|
|
30
|
+
aria-label="${this.removeButtonText} ${this.name}"
|
|
31
|
+
>
|
|
32
|
+
${this.removeButtonIconName
|
|
33
|
+
? html `<h-icon
|
|
34
|
+
class="${ICON_CSS_CLASSES.icon} ${FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
35
|
+
icon-name=${this.removeButtonIconName}
|
|
36
|
+
/>`
|
|
37
|
+
: nothing}
|
|
38
|
+
${this.removeButtonText}
|
|
39
|
+
</button>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
__decorate([
|
|
44
|
+
property({ type: String }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], HFile.prototype, "name", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
property({ type: String, attribute: 'container-id' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], HFile.prototype, "containerId", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
property({ type: String, attribute: 'remove-button-text' }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], HFile.prototype, "removeButtonText", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], HFile.prototype, "removeButtonIconName", void 0);
|
|
59
|
+
HFile = __decorate([
|
|
60
|
+
phoenixCustomElement('h-file'),
|
|
61
|
+
__metadata("design:paramtypes", [])
|
|
62
|
+
], HFile);
|
|
63
|
+
|
|
64
|
+
export { HFile };
|
|
65
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,kDAAsD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TFileItemConstructorOptions } from '../file_picker_constants';
|
|
2
|
+
export declare class FileItem {
|
|
3
|
+
name: string;
|
|
4
|
+
containerId: string;
|
|
5
|
+
removeButtonText: string;
|
|
6
|
+
removeButtonIconName: string | undefined;
|
|
7
|
+
private constructor();
|
|
8
|
+
static create(options: TFileItemConstructorOptions): FileItem;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class FileItem {
|
|
2
|
+
constructor({ name, containerId, removeButtonText, removeButtonIconName }) {
|
|
3
|
+
this.name = name;
|
|
4
|
+
this.containerId = containerId;
|
|
5
|
+
this.removeButtonText = removeButtonText;
|
|
6
|
+
this.removeButtonIconName = removeButtonIconName;
|
|
7
|
+
}
|
|
8
|
+
static create(options) {
|
|
9
|
+
return new FileItem(options);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { FileItem };
|
|
14
|
+
//# sourceMappingURL=file_model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { FileItem } from "./file/file_model";
|
|
3
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
4
|
+
export declare class HFilePicker extends PhoenixLightLitElement {
|
|
5
|
+
controlId: string;
|
|
6
|
+
controlName: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
error: boolean;
|
|
10
|
+
labelText: string;
|
|
11
|
+
labelIconName: string;
|
|
12
|
+
removeButtonText: string;
|
|
13
|
+
removeButtonIconName: string;
|
|
14
|
+
accept: string;
|
|
15
|
+
files: FileList | null;
|
|
16
|
+
file: FileItem;
|
|
17
|
+
private _$fileInputRef;
|
|
18
|
+
constructor();
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
protected render(): TemplateResult;
|
|
22
|
+
private _addEventListeners;
|
|
23
|
+
private _handleChangeEvent;
|
|
24
|
+
private _getFiles;
|
|
25
|
+
private _getFileName;
|
|
26
|
+
private _getInputRefValue;
|
|
27
|
+
private _removeFileItem;
|
|
28
|
+
private _triggerClickOnLabel;
|
|
29
|
+
private _dispatchChangeEvent;
|
|
30
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property, state } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import classnames from '../../../../external/classnames/index.js';
|
|
7
|
+
import { createRef, ref } from 'lit-html/directives/ref.js';
|
|
8
|
+
import { FILE_PICKER_CONTROL_CSS_CLASSES, FILE_ITEM_EVENT_NAMES, FILE_PICKER_LABEL_EVENT_NAMES } from './file_picker_constants.js';
|
|
9
|
+
import { FileItem } from './file/file_model.js';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined';
|
|
11
|
+
|
|
12
|
+
let HFilePicker = class HFilePicker extends PhoenixLightLitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this._$fileInputRef = createRef();
|
|
16
|
+
this._handleChangeEvent = (event) => {
|
|
17
|
+
const filesList = this._getFiles(event);
|
|
18
|
+
if (filesList.length > 0) {
|
|
19
|
+
this.file = FileItem.create({
|
|
20
|
+
name: this._getFileName(filesList),
|
|
21
|
+
containerId: this.controlId,
|
|
22
|
+
removeButtonText: this.removeButtonText,
|
|
23
|
+
removeButtonIconName: this.removeButtonIconName
|
|
24
|
+
});
|
|
25
|
+
this.classList.add(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
26
|
+
this._dispatchChangeEvent();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this._getFiles = (event) => {
|
|
30
|
+
const targetElement = event.currentTarget;
|
|
31
|
+
this.files = targetElement.files;
|
|
32
|
+
return this.files;
|
|
33
|
+
};
|
|
34
|
+
this._getFileName = (fileList) => {
|
|
35
|
+
return fileList[0].name;
|
|
36
|
+
};
|
|
37
|
+
this._getInputRefValue = () => {
|
|
38
|
+
return this._$fileInputRef.value;
|
|
39
|
+
};
|
|
40
|
+
this._removeFileItem = () => {
|
|
41
|
+
const $fileInput = this._getInputRefValue();
|
|
42
|
+
if ($fileInput)
|
|
43
|
+
$fileInput.value = '';
|
|
44
|
+
this.files = null;
|
|
45
|
+
this.file = FileItem.create({
|
|
46
|
+
name: '',
|
|
47
|
+
containerId: '',
|
|
48
|
+
removeButtonText: '',
|
|
49
|
+
removeButtonIconName: ''
|
|
50
|
+
});
|
|
51
|
+
this.classList.remove(FILE_PICKER_CONTROL_CSS_CLASSES.filePickerHasValue);
|
|
52
|
+
this._dispatchChangeEvent();
|
|
53
|
+
};
|
|
54
|
+
this._triggerClickOnLabel = () => {
|
|
55
|
+
const $fileInput = this._getInputRefValue();
|
|
56
|
+
if ($fileInput)
|
|
57
|
+
$fileInput.click();
|
|
58
|
+
};
|
|
59
|
+
this._dispatchChangeEvent = () => {
|
|
60
|
+
this.dispatchEvent(new Event('change'));
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
this._addEventListeners();
|
|
66
|
+
const cssClasses = classnames({
|
|
67
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerDisabled]: this.disabled,
|
|
68
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerRequired]: this.required,
|
|
69
|
+
[FILE_PICKER_CONTROL_CSS_CLASSES.filePickerError]: this.error
|
|
70
|
+
});
|
|
71
|
+
if (cssClasses)
|
|
72
|
+
this.classList.add(cssClasses);
|
|
73
|
+
}
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
super.disconnectedCallback();
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
super.render();
|
|
80
|
+
return html `
|
|
81
|
+
<input
|
|
82
|
+
${ref(this._$fileInputRef)}
|
|
83
|
+
type="file"
|
|
84
|
+
class="${FILE_PICKER_CONTROL_CSS_CLASSES.filePickerInput}"
|
|
85
|
+
id="${ifDefined(this.controlId)}"
|
|
86
|
+
name="${ifDefined(this.controlName)}"
|
|
87
|
+
?disabled="${this.disabled}"
|
|
88
|
+
?required="${this.required}"
|
|
89
|
+
accept="${ifDefined(this.accept)}"
|
|
90
|
+
@change="${this._handleChangeEvent}"
|
|
91
|
+
hidden
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
${!((_a = this.file) === null || _a === void 0 ? void 0 : _a.name)
|
|
95
|
+
? html ` <h-file-picker-label
|
|
96
|
+
control-id="${this.controlId}"
|
|
97
|
+
label-text="${this.labelText}"
|
|
98
|
+
label-icon-name="${ifDefined(this.labelIconName)}"
|
|
99
|
+
/>`
|
|
100
|
+
: nothing}
|
|
101
|
+
${((_b = this.file) === null || _b === void 0 ? void 0 : _b.name)
|
|
102
|
+
? html `<h-file
|
|
103
|
+
name="${this.file.name}"
|
|
104
|
+
container-id="${this.file.containerId}"
|
|
105
|
+
remove-button-text="${this.file.removeButtonText}"
|
|
106
|
+
remove-button-icon-name="${ifDefined(this.file.removeButtonIconName)}"
|
|
107
|
+
/>`
|
|
108
|
+
: nothing}
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
_addEventListeners() {
|
|
112
|
+
this.addEventListener(FILE_ITEM_EVENT_NAMES.removed, this._removeFileItem);
|
|
113
|
+
this.addEventListener(FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, this._triggerClickOnLabel);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: String, attribute: 'control-id', reflect: true }),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], HFilePicker.prototype, "controlId", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
property({ type: String, attribute: 'control-name' }),
|
|
122
|
+
__metadata("design:type", String)
|
|
123
|
+
], HFilePicker.prototype, "controlName", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Boolean }),
|
|
126
|
+
__metadata("design:type", Boolean)
|
|
127
|
+
], HFilePicker.prototype, "disabled", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: Boolean }),
|
|
130
|
+
__metadata("design:type", Boolean)
|
|
131
|
+
], HFilePicker.prototype, "required", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: Boolean }),
|
|
134
|
+
__metadata("design:type", Boolean)
|
|
135
|
+
], HFilePicker.prototype, "error", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: String, attribute: 'label-text' }),
|
|
138
|
+
__metadata("design:type", String)
|
|
139
|
+
], HFilePicker.prototype, "labelText", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: String, attribute: 'label-icon-name' }),
|
|
142
|
+
__metadata("design:type", String)
|
|
143
|
+
], HFilePicker.prototype, "labelIconName", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
property({ type: String, attribute: 'remove-button-text' }),
|
|
146
|
+
__metadata("design:type", String)
|
|
147
|
+
], HFilePicker.prototype, "removeButtonText", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: String, attribute: 'remove-button-icon-name' }),
|
|
150
|
+
__metadata("design:type", String)
|
|
151
|
+
], HFilePicker.prototype, "removeButtonIconName", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
property({ type: String }),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], HFilePicker.prototype, "accept", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: FileList, reflect: true }),
|
|
158
|
+
__metadata("design:type", Object)
|
|
159
|
+
], HFilePicker.prototype, "files", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
state(),
|
|
162
|
+
__metadata("design:type", FileItem)
|
|
163
|
+
], HFilePicker.prototype, "file", void 0);
|
|
164
|
+
HFilePicker = __decorate([
|
|
165
|
+
phoenixCustomElement('h-file-picker'),
|
|
166
|
+
__metadata("design:paramtypes", [])
|
|
167
|
+
], HFilePicker);
|
|
168
|
+
|
|
169
|
+
export { HFilePicker };
|
|
170
|
+
//# sourceMappingURL=file_picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA,uBAAuB,0CAA8C;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const FILE_ITEM_CSS_CLASSES: {
|
|
2
|
+
readonly file: "file";
|
|
3
|
+
readonly fileName: "file__name";
|
|
4
|
+
readonly fileRemoveButton: "file__remove-button";
|
|
5
|
+
};
|
|
6
|
+
export declare const FILE_ITEM_EVENT_NAMES: {
|
|
7
|
+
readonly removed: "fileItemRemoved";
|
|
8
|
+
};
|
|
9
|
+
export declare type TFileItemConstructorOptions = {
|
|
10
|
+
name: string;
|
|
11
|
+
containerId: string;
|
|
12
|
+
removeButtonText: string;
|
|
13
|
+
removeButtonIconName?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const FILE_PICKER_CONTROL_CSS_CLASSES: {
|
|
16
|
+
readonly filePicker: "file-picker";
|
|
17
|
+
readonly filePickerDisabled: "file-picker_disabled";
|
|
18
|
+
readonly filePickerRequired: "file-picker_required";
|
|
19
|
+
readonly filePickerError: "file-picker_error";
|
|
20
|
+
readonly filePickerHasValue: "file-picker_has-value";
|
|
21
|
+
readonly filePickerInput: "file-picker__input";
|
|
22
|
+
readonly filePickerLabel: "file-picker__label";
|
|
23
|
+
};
|
|
24
|
+
export declare const FILE_PICKER_LABEL_EVENT_NAMES: {
|
|
25
|
+
readonly filePickerLabelClickedByEnterKey: "filePickerLabelClickedByEnterKey";
|
|
26
|
+
};
|
|
27
|
+
export declare const FILE_PICKER_ICON_CSS_CLASSES: {
|
|
28
|
+
readonly filePickerIcon: "file-picker-icon";
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const baseFileItemClass = 'file';
|
|
2
|
+
const FILE_ITEM_CSS_CLASSES = {
|
|
3
|
+
file: baseFileItemClass,
|
|
4
|
+
fileName: `${baseFileItemClass}__name`,
|
|
5
|
+
fileRemoveButton: `${baseFileItemClass}__remove-button`
|
|
6
|
+
};
|
|
7
|
+
const FILE_ITEM_EVENT_NAMES = {
|
|
8
|
+
removed: 'fileItemRemoved'
|
|
9
|
+
};
|
|
10
|
+
const baseFilePickerControlClass = 'file-picker';
|
|
11
|
+
const FILE_PICKER_CONTROL_CSS_CLASSES = {
|
|
12
|
+
filePicker: baseFilePickerControlClass,
|
|
13
|
+
filePickerDisabled: `${baseFilePickerControlClass}_disabled`,
|
|
14
|
+
filePickerRequired: `${baseFilePickerControlClass}_required`,
|
|
15
|
+
filePickerError: `${baseFilePickerControlClass}_error`,
|
|
16
|
+
filePickerHasValue: `${baseFilePickerControlClass}_has-value`,
|
|
17
|
+
filePickerInput: `${baseFilePickerControlClass}__input`,
|
|
18
|
+
filePickerLabel: `${baseFilePickerControlClass}__label`
|
|
19
|
+
};
|
|
20
|
+
const FILE_PICKER_LABEL_EVENT_NAMES = {
|
|
21
|
+
filePickerLabelClickedByEnterKey: 'filePickerLabelClickedByEnterKey'
|
|
22
|
+
};
|
|
23
|
+
const baseFilePickerIconClass = 'file-picker-icon';
|
|
24
|
+
const FILE_PICKER_ICON_CSS_CLASSES = {
|
|
25
|
+
filePickerIcon: baseFilePickerIconClass
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { FILE_ITEM_CSS_CLASSES, FILE_ITEM_EVENT_NAMES, FILE_PICKER_CONTROL_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES, FILE_PICKER_LABEL_EVENT_NAMES };
|
|
29
|
+
//# sourceMappingURL=file_picker_constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import { PhoenixLightLitElement } from "../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
3
|
+
export declare class HFilePickerLabel extends PhoenixLightLitElement {
|
|
4
|
+
controlId: string;
|
|
5
|
+
labelText: string;
|
|
6
|
+
labelIconName: string;
|
|
7
|
+
private _btnController;
|
|
8
|
+
constructor();
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
protected render(): TemplateResult;
|
|
12
|
+
private _dispatchClickEvent;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __decorate, __metadata } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators';
|
|
4
|
+
import { PhoenixLightLitElement } from '../../../core/phoenix_light_lit_element/phoenix_light_lit_element.js';
|
|
5
|
+
import { phoenixCustomElement } from '../../../core/decorators/phoenix_custom_element.js';
|
|
6
|
+
import { BtnController } from '../../../controllers/btn_controller/btn_controller.js';
|
|
7
|
+
import { ICON_CSS_CLASSES } from '../../icon/icon_constants.js';
|
|
8
|
+
import { FILE_PICKER_LABEL_EVENT_NAMES, FILE_PICKER_CONTROL_CSS_CLASSES, FILE_PICKER_ICON_CSS_CLASSES } from './file_picker_constants.js';
|
|
9
|
+
|
|
10
|
+
let HFilePickerLabel = class HFilePickerLabel extends PhoenixLightLitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this._dispatchClickEvent = () => {
|
|
14
|
+
this.dispatchEvent(new CustomEvent(FILE_PICKER_LABEL_EVENT_NAMES.filePickerLabelClickedByEnterKey, {
|
|
15
|
+
bubbles: true
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
this._btnController = new BtnController(this, this._dispatchClickEvent);
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback();
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
super.render();
|
|
28
|
+
return html `<label class="${FILE_PICKER_CONTROL_CSS_CLASSES.filePickerLabel}" for="${this.controlId}">
|
|
29
|
+
${this.labelIconName
|
|
30
|
+
? html `<h-icon
|
|
31
|
+
class="${ICON_CSS_CLASSES.icon} ${FILE_PICKER_ICON_CSS_CLASSES.filePickerIcon}"
|
|
32
|
+
icon-name=${this.labelIconName}
|
|
33
|
+
/>`
|
|
34
|
+
: nothing}
|
|
35
|
+
${this.labelText}
|
|
36
|
+
</label>`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
__decorate([
|
|
40
|
+
property({ type: String, attribute: 'control-id', reflect: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], HFilePickerLabel.prototype, "controlId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
property({ type: String, attribute: 'label-text' }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], HFilePickerLabel.prototype, "labelText", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
property({ type: String, attribute: 'label-icon-name' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], HFilePickerLabel.prototype, "labelIconName", void 0);
|
|
51
|
+
HFilePickerLabel = __decorate([
|
|
52
|
+
phoenixCustomElement('h-file-picker-label'),
|
|
53
|
+
__metadata("design:paramtypes", [])
|
|
54
|
+
], HFilePickerLabel);
|
|
55
|
+
|
|
56
|
+
export { HFilePickerLabel };
|
|
57
|
+
//# sourceMappingURL=file_picker_label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,+CAAmD;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PhoenixLightLitElement } from "../../../../../core/phoenix_light_lit_element/phoenix_light_lit_element";
|
|
2
|
-
import { PropertyValues } from '@lit/reactive-element';
|
|
3
2
|
export declare class HOption extends PhoenixLightLitElement {
|
|
4
3
|
value: string;
|
|
5
4
|
selected: boolean;
|
|
@@ -10,7 +9,7 @@ export declare class HOption extends PhoenixLightLitElement {
|
|
|
10
9
|
connectedCallback(): void;
|
|
11
10
|
private _setupEvents;
|
|
12
11
|
private _dispatchClickedEvent;
|
|
13
|
-
|
|
12
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
14
13
|
private _addSelectedIcon;
|
|
15
14
|
private _removeSelectedIcon;
|
|
16
15
|
}
|
package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js
CHANGED
|
@@ -5,7 +5,6 @@ import { property } from '@lit/reactive-element/decorators.js';
|
|
|
5
5
|
import { SELECT_OPTION_EVENT_NAMES, SELECT_RELATED_COMPONENTS_NAMES } from '../select_components_constatns.js';
|
|
6
6
|
import { BtnController } from '../../../../../controllers/btn_controller/btn_controller.js';
|
|
7
7
|
import { SELECT_OPTION_CSS_CLASSES } from './select_option_constants.js';
|
|
8
|
-
import '@lit/reactive-element';
|
|
9
8
|
|
|
10
9
|
let HOption = class HOption extends PhoenixLightLitElement {
|
|
11
10
|
constructor() {
|
|
@@ -34,10 +33,12 @@ let HOption = class HOption extends PhoenixLightLitElement {
|
|
|
34
33
|
_setupEvents() {
|
|
35
34
|
this.addEventListener('click', this._dispatchClickedEvent);
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
super.
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
attributeChangedCallback(name, _old, value) {
|
|
37
|
+
super.attributeChangedCallback(name, _old, value);
|
|
38
|
+
switch (name) {
|
|
39
|
+
case 'selected':
|
|
40
|
+
this.selected ? this._addSelectedIcon() : this._removeSelectedIcon();
|
|
41
|
+
}
|
|
41
42
|
}
|
|
42
43
|
_addSelectedIcon() {
|
|
43
44
|
this._$checkedIcon = document.createElement('h-icon');
|
package/build/esm/packages/phoenix/src/components/form/select/components/option/select_option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,uCAAuC,qDAAyD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -13,15 +13,15 @@ export declare abstract class BaseSelectController implements ISelectController,
|
|
|
13
13
|
constructor({ host }: SelectControllerConstructorOptions);
|
|
14
14
|
private _setupComputedStateObserver;
|
|
15
15
|
private _calculateValuesRelatedToOptions;
|
|
16
|
-
|
|
17
|
-
abstract
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
protected
|
|
25
|
-
|
|
16
|
+
toggleOption(option: SelectOption): void;
|
|
17
|
+
abstract selectOption(option: SelectOption): void;
|
|
18
|
+
removeOption(optionValue: string): void;
|
|
19
|
+
addOption(option: SelectOption, position?: number): void;
|
|
20
|
+
replaceOptions(options: SelectOption[]): void;
|
|
21
|
+
deselectOptions(): void;
|
|
22
|
+
deselectOption(option: SelectOption): void;
|
|
23
|
+
filterOptions(value: string): void;
|
|
24
|
+
protected requestOptionsUpdate(): void;
|
|
25
|
+
getSelectOption(selectValue: string): SelectOption | undefined;
|
|
26
26
|
hostConnected(): void;
|
|
27
27
|
}
|
package/build/esm/packages/phoenix/src/components/form/select/controllers/base_select_controller.js
CHANGED
|
@@ -25,16 +25,16 @@ class BaseSelectController {
|
|
|
25
25
|
this._optionsObserver = new Observer(this._calculateValuesRelatedToOptions);
|
|
26
26
|
this.options$.subscribe(this._optionsObserver);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
option.selected ? this.
|
|
28
|
+
toggleOption(option) {
|
|
29
|
+
option.selected ? this.deselectOption(option) : this.selectOption(option);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
removeOption(optionValue) {
|
|
32
32
|
const options = this.options$.getValue();
|
|
33
33
|
if (!options)
|
|
34
34
|
return;
|
|
35
35
|
this.options$.notify(options.filter((option) => option.value !== optionValue));
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
addOption(option, position) {
|
|
38
38
|
var _a;
|
|
39
39
|
const options = (_a = this.options$.getValue()) !== null && _a !== void 0 ? _a : [];
|
|
40
40
|
if (position === undefined) {
|
|
@@ -44,22 +44,22 @@ class BaseSelectController {
|
|
|
44
44
|
}
|
|
45
45
|
this.options$.notify([...options.slice(0, position - 1), option, ...options.slice(position - 1)]);
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
replaceOptions(options) {
|
|
48
48
|
this.options$.notify(options);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
deselectOptions() {
|
|
51
51
|
var _a;
|
|
52
52
|
(_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.forEach((option) => (option.selected = false));
|
|
53
53
|
this.selectedOptions$.notify([]);
|
|
54
|
-
this.
|
|
54
|
+
this.requestOptionsUpdate();
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
deselectOption(option) {
|
|
57
57
|
var _a;
|
|
58
58
|
(_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.forEach((option) => (option.selected = false));
|
|
59
59
|
this.selectedOptions$.notify([]);
|
|
60
|
-
this.
|
|
60
|
+
this.requestOptionsUpdate();
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
filterOptions(value) {
|
|
63
63
|
const selectOptions = this.options$.getValue();
|
|
64
64
|
if (!selectOptions)
|
|
65
65
|
return;
|
|
@@ -68,16 +68,16 @@ class BaseSelectController {
|
|
|
68
68
|
filtered.forEach((option) => {
|
|
69
69
|
option.hidden = false;
|
|
70
70
|
});
|
|
71
|
-
this.
|
|
71
|
+
this.requestOptionsUpdate();
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
requestOptionsUpdate() {
|
|
74
74
|
const selectOptions = this.options$.getValue();
|
|
75
75
|
if (!selectOptions)
|
|
76
76
|
return;
|
|
77
77
|
this.options$.notify([...selectOptions]);
|
|
78
78
|
this.host.requestUpdate();
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
getSelectOption(selectValue) {
|
|
81
81
|
var _a;
|
|
82
82
|
return (_a = this.options$.getValue()) === null || _a === void 0 ? void 0 : _a.find((option) => option.value === selectValue);
|
|
83
83
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectOption } from "../model/select_option";
|
|
2
2
|
import { BaseSelectController } from "./base_select_controller";
|
|
3
3
|
export declare class MultiSelectController extends BaseSelectController {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
toggleOption(option: SelectOption): void;
|
|
5
|
+
selectOption(option: SelectOption): void;
|
|
6
|
+
deselectOption(option: SelectOption): void;
|
|
7
7
|
}
|
package/build/esm/packages/phoenix/src/components/form/select/controllers/multi_select_controller.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { BaseSelectController } from './base_select_controller.js';
|
|
2
2
|
|
|
3
3
|
class MultiSelectController extends BaseSelectController {
|
|
4
|
-
|
|
5
|
-
option.selected ? this.
|
|
4
|
+
toggleOption(option) {
|
|
5
|
+
option.selected ? this.deselectOption(option) : this.selectOption(option);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
selectOption(option) {
|
|
8
8
|
option.selected = true;
|
|
9
9
|
this.selectedOptions$.notify((selectedOptions) => [...selectedOptions, option]);
|
|
10
|
-
this.
|
|
10
|
+
this.requestOptionsUpdate();
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
deselectOption(option) {
|
|
13
13
|
option.selected = false;
|
|
14
14
|
this.selectedOptions$.notify((selectedOptions) => selectedOptions.filter((currOption) => currOption.value !== option.value));
|
|
15
|
-
this.
|
|
15
|
+
this.requestOptionsUpdate();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
package/build/esm/packages/phoenix/src/components/form/select/controllers/select_controller.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectOption } from "../model/select_option";
|
|
2
2
|
import { BaseSelectController } from "./base_select_controller";
|
|
3
3
|
export declare class SelectController extends BaseSelectController {
|
|
4
|
-
|
|
4
|
+
selectOption(option: SelectOption): void;
|
|
5
5
|
}
|