@genexus/genexus-ide-ui 0.0.62 → 0.0.63
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/{ch-tree-x_3.cjs.entry.js → ch-checkbox_4.cjs.entry.js} +277 -71
- package/dist/cjs/ch-next-data-modeling-render.cjs.entry.js +242 -0
- package/dist/cjs/{ch-next-data-modeling-item.cjs.entry.js → ch-next-data-modeling_2.cjs.entry.js} +20 -1
- package/dist/cjs/ch-tree-view-render-wrapper.cjs.entry.js +160 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-kb-manager-export.cjs.entry.js +41 -39
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +23 -11
- package/dist/cjs/gx-ide-test.cjs.entry.js +107 -122
- package/dist/cjs/gxg-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/gxg-title-editable.cjs.entry.js +11 -4
- package/dist/cjs/{gxg-tree_2.cjs.entry.js → gxg-tree-item.cjs.entry.js} +0 -212
- package/dist/cjs/gxg-tree-view.cjs.entry.js +165 -0
- package/dist/cjs/gxg-tree.cjs.entry.js +218 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/_test/test.css +5 -0
- package/dist/collection/components/_test/test.js +109 -220
- package/dist/collection/components/kb-manager-export/helpers.js +7 -23
- package/dist/collection/components/kb-manager-export/kb-manager-export.css +20 -0
- package/dist/collection/components/kb-manager-export/kb-manager-export.js +42 -22
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +1 -0
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +23 -11
- package/dist/components/ch-next-data-modeling-item.js +1 -457
- package/dist/components/ch-next-data-modeling-render.js +295 -0
- package/dist/components/ch-next-data-modeling.js +1 -27
- package/dist/components/ch-tree-view-item.js +6 -0
- package/dist/components/ch-tree-view-render-wrapper.js +224 -0
- package/dist/components/ch-tree-view-render.js +6 -0
- package/dist/components/ch-tree-view.js +6 -0
- package/dist/components/gx-ide-kb-manager-export.js +75 -73
- package/dist/components/gx-ide-kb-manager-import.js +38 -20
- package/dist/components/gx-ide-references.js +21 -15
- package/dist/components/gx-ide-test.js +120 -160
- package/dist/components/gxg-color-picker.js +2 -2
- package/dist/components/gxg-title-editable.js +12 -4
- package/dist/components/gxg-tree-item.js +614 -1
- package/dist/components/gxg-tree-view.js +2 -2
- package/dist/components/gxg-tree.js +236 -1
- package/dist/components/index.js +5 -3
- package/dist/components/next-data-modeling-item.js +466 -0
- package/dist/{esm/ch-next-data-modeling.entry.js → components/next-data-modeling.js} +21 -7
- package/dist/components/{tree-x-list-item.js → tree-view-item.js} +9 -9
- package/dist/components/{ch-test-tree-x.js → tree-view-render.js} +168 -28
- package/dist/components/tree-view.js +410 -435
- package/dist/components/tree-view2.js +226 -0
- package/dist/esm/{ch-tree-x_3.entry.js → ch-checkbox_4.entry.js} +275 -70
- package/dist/esm/ch-next-data-modeling-render.entry.js +238 -0
- package/dist/esm/{ch-next-data-modeling-item.entry.js → ch-next-data-modeling_2.entry.js} +21 -3
- package/dist/esm/ch-tree-view-render-wrapper.entry.js +156 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-kb-manager-export.entry.js +41 -39
- package/dist/esm/gx-ide-kb-manager-import.entry.js +23 -11
- package/dist/esm/gx-ide-test.entry.js +108 -123
- package/dist/esm/gxg-color-picker.entry.js +2 -2
- package/dist/esm/gxg-title-editable.entry.js +11 -4
- package/dist/{components/gxg-tree-item2.js → esm/gxg-tree-item.entry.js} +9 -79
- package/dist/esm/gxg-tree-view.entry.js +161 -0
- package/dist/{components/gxg-tree2.js → esm/gxg-tree.entry.js} +8 -32
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.css +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +1 -0
- package/dist/genexus-ide-ui/p-13177896.entry.js +1 -0
- package/dist/genexus-ide-ui/p-19fef562.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2781b92a.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2c17e71d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-40a57a36.entry.js +1 -0
- package/dist/genexus-ide-ui/p-636d02fa.entry.js +1 -0
- package/dist/genexus-ide-ui/p-7b63be93.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8a7c4561.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a2cb0e6b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a9c8b373.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b819706e.entry.js +1 -0
- package/dist/genexus-ide-ui/p-bacd879c.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/next/data-modeling-render/next-data-modeling-render.css +3 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/tree-view/tree-view-render.css +3 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-view/tree-view-render-wrapper.css +0 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/tree-view/tree-view.css +45 -0
- package/dist/node_modules/@genexus/gemini/dist/collection/components/title-editable/title-editable.css +17 -3
- package/dist/node_modules/@genexus/gemini/dist/collection/components/tree-view/tree-view.css +5 -2
- package/dist/types/common/helpers.d.ts +2 -2
- package/dist/types/components/_test/test.d.ts +3 -35
- package/dist/types/components/kb-manager-export/helpers.d.ts +4 -4
- package/dist/types/components/kb-manager-export/kb-manager-export.d.ts +10 -5
- package/dist/types/components/kb-manager-import/helpers.d.ts +3 -3
- package/dist/types/components/kb-manager-import/kb-manager-import.d.ts +7 -6
- package/dist/types/components/references/helpers.d.ts +2 -2
- package/dist/types/components/references/references.d.ts +3 -3
- package/dist/types/components.d.ts +3 -60
- package/package.json +3 -3
- package/dist/cjs/ch-checkbox.cjs.entry.js +0 -93
- package/dist/cjs/ch-next-data-modeling.cjs.entry.js +0 -19
- package/dist/cjs/ch-test-tree-x.cjs.entry.js +0 -458
- package/dist/components/ch-tree-x-list-item.js +0 -6
- package/dist/components/ch-tree-x.js +0 -6
- package/dist/components/tree-x.js +0 -504
- package/dist/esm/ch-checkbox.entry.js +0 -89
- package/dist/esm/ch-test-tree-x.entry.js +0 -454
- package/dist/esm/gxg-tree_2.entry.js +0 -757
- package/dist/genexus-ide-ui/p-092ccacd.entry.js +0 -1
- package/dist/genexus-ide-ui/p-1ad68b23.entry.js +0 -3
- package/dist/genexus-ide-ui/p-3442d19a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-39968306.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5755f985.entry.js +0 -1
- package/dist/genexus-ide-ui/p-85597097.entry.js +0 -1
- package/dist/genexus-ide-ui/p-9e530c7d.entry.js +0 -1
- package/dist/genexus-ide-ui/p-ad5040e4.entry.js +0 -1
- package/dist/genexus-ide-ui/p-aeb3b032.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c53522c9.entry.js +0 -1
- package/dist/genexus-ide-ui/p-d104f9a4.entry.js +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/tree-x/tree-x.css +0 -45
- /package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/{tree-x-list-item/tree-x-list-item.css → tree-view-item/tree-view-item.css} +0 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { K as KEY_CODES } from './reserverd-names.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './accordion.js';
|
|
4
|
+
|
|
5
|
+
const nextDataModelingItemCss = ":where(button){all:unset;display:inline-flex;cursor:pointer}*,::before,::after{box-sizing:border-box}.error-text,.name{color:inherit;font:inherit;margin:0;padding:0;outline:0}gx-edit:is(.gx-edit--auto-fill,.gx-edit--auto-fill:focus-within,.gx-edit--auto-fill:hover){background-color:var(--gx-edit-auto-fill-background-color)}:host{display:grid;--chevron-color:#ccc}:host(:hover) .button-primary,:host(:focus-within) .button-primary{display:grid}:host(:hover) .button-primary::before,:host(:focus-within) .button-primary::before{content:\"\"}:host(.gx-disabled){pointer-events:none}.add-new-field--level-0{display:grid;grid-template:\"name . . .\" min-content \"field-name type confirm cancel\" 1fr \"error-text . confirm cancel\" min-content \"sub-item sub-item confirm cancel\" min-content/1fr min-content 56px 32px;row-gap:8px}.add-new-field--level-0 ::slotted(ch-next-data-modeling){grid-area:sub-item}.add-new-field--level-1{display:grid;grid-template:\"name . . .\" min-content \"field-name type confirm cancel\" 1fr \"error-text . . .\" min-content/1fr min-content 56px 32px;row-gap:8px}.add-new-field--level-2{display:grid;grid-template:\"sub-field name . . .\" min-content \". field-name type confirm cancel\" 1fr \". error-text . . .\" min-content/min-content 1fr min-content 56px 32px;row-gap:4px}.add-new-field--no-actions{grid-template:\"sub-field name .\" min-content \". field-name type\" 1fr \". error-text .\" min-content/min-content 1fr min-content}.accordion:hover .edit-button,.accordion:hover .delete-button,.accordion:focus-within .edit-button,.accordion:focus-within .delete-button{display:grid}.sub-field{grid-area:sub-field}.field-name{grid-area:field-name;margin-inline-end:8px}.button-confirm{grid-area:confirm;margin-inline:16px 8px}.button-cancel{grid-area:cancel}.error-text{grid-area:error-text;display:flex;white-space:break-spaces}.header{display:grid;grid-template:\"sub-field name type edit delete\" 1fr/min-content max-content 1fr min-content max-content;align-items:center;width:100%;margin-inline-end:12px}.accordion::part(accordion__header){column-gap:24px}.edit-mode{grid-template:\"sub-field field-name type confirm cancel\" min-content \"sub-field error-text error-text confirm cancel\" min-content/min-content 1fr min-content 56px 32px}.name{grid-area:name}.name-entity{text-decoration:underline}.type{grid-area:type}.select-wrapper{--chevron:url('data:image/svg+xml,<svg width=\"12\" height=\"8\" viewBox=\"0 0 12 8\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.41 0L6 4.59L10.59 0L12 1.42L6 7.42L0 1.42L1.41 0Z\"/></svg>');grid-area:type;position:relative}.select-wrapper::after{content:\"\";display:flex;position:absolute;inset-inline-end:0;inset-block-start:calc(50% - 3.75px);width:12px;height:7.5px;margin-inline:8px 16px;-webkit-mask:var(--chevron) no-repeat;background-color:var(--chevron-color);pointer-events:none}.select{display:flex;height:100%;appearance:none;background-color:unset;cursor:pointer;outline:unset;transition-property:background-color, border-color, color;transition-duration:250ms}.button-new-entity{align-items:center;transition:color 250ms}.optimization{display:contents}.button-primary{display:none;align-self:center;height:20px;padding:2px}.button-primary::before{display:flex}.button-edit{grid-area:edit;width:21px}.button-edit::before{-webkit-mask:var(--edit-icon) no-repeat}.button-delete{grid-area:delete;width:18px;margin-inline-start:12px}.button-delete::before{-webkit-mask:var(--delete-icon) no-repeat}.delete-mode,.waiting-mode{grid-area:delete;display:grid;grid-template-columns:1fr 24px 24px;align-items:center;column-gap:8px;cursor:auto;animation:fade-in 250ms ease-in-out}.waiting-mode{grid-template-columns:24px 1fr}.waiting-mode__loading{order:-1;width:100%;fill:none;animation:rotate 1.5s linear 0.125s infinite}circle{stroke:currentColor;stroke-dasharray:1, 200;stroke-linecap:round;animation:indeterminate-loading 1.25s ease-in-out 0.125s infinite}@keyframes fade-in{0%{opacity:0}}@keyframes rotate{100%{transform:rotate(1turn)}}@keyframes indeterminate-loading{50%,60%{stroke-dasharray:20, 200;stroke-dashoffset:-8px}100%{stroke-dashoffset:-24px}}";
|
|
6
|
+
|
|
7
|
+
const NAME = "name";
|
|
8
|
+
const PART_PREFIX = "dm-item__";
|
|
9
|
+
const CANCEL_CLASS = "button-cancel";
|
|
10
|
+
const CONFIRM_CLASS = "button-confirm";
|
|
11
|
+
const BUTTON_CONFIRM_PART = (disabledPart) => `${PART_PREFIX}button-action confirm${disabledPart}`;
|
|
12
|
+
const BUTTON_CANCEL_PART = (disabledPart) => `${PART_PREFIX}button-action cancel${disabledPart}`;
|
|
13
|
+
const SELECT_OPTION_PART = `${PART_PREFIX}select-option`;
|
|
14
|
+
const NextDataModelingSubitem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.__registerHost();
|
|
18
|
+
this.__attachShadow();
|
|
19
|
+
this.deleteField = createEvent(this, "deleteField", 7);
|
|
20
|
+
this.editField = createEvent(this, "editField", 7);
|
|
21
|
+
this.newEntity = createEvent(this, "newEntity", 7);
|
|
22
|
+
this.firstNewField = createEvent(this, "firstNewField", 7);
|
|
23
|
+
this.firstNewFieldErrors = createEvent(this, "firstNewFieldErrors", 7);
|
|
24
|
+
this.newField = createEvent(this, "newField", 7);
|
|
25
|
+
/**
|
|
26
|
+
* The metadata used for the different actions in the UI.
|
|
27
|
+
*/
|
|
28
|
+
this.actions = (captions, disabledPart) => ({
|
|
29
|
+
add: [
|
|
30
|
+
{
|
|
31
|
+
// Confirm add
|
|
32
|
+
label: captions.confirm,
|
|
33
|
+
class: CONFIRM_CLASS,
|
|
34
|
+
part: BUTTON_CONFIRM_PART(disabledPart),
|
|
35
|
+
event: this.confirmAction("new")
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
// Cancel add
|
|
39
|
+
label: captions.cancel,
|
|
40
|
+
class: CANCEL_CLASS,
|
|
41
|
+
part: BUTTON_CANCEL_PART(disabledPart),
|
|
42
|
+
event: this.toggleShowNewField
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
delete: [
|
|
46
|
+
{
|
|
47
|
+
// Confirm delete
|
|
48
|
+
label: captions.confirm,
|
|
49
|
+
class: undefined,
|
|
50
|
+
part: `${PART_PREFIX}button-delete-action confirm${disabledPart}`,
|
|
51
|
+
event: this.emitDelete
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
// Cancel delete
|
|
55
|
+
label: captions.cancel,
|
|
56
|
+
class: undefined,
|
|
57
|
+
part: `${PART_PREFIX}button-delete-action cancel${disabledPart}`,
|
|
58
|
+
event: this.toggleMode("delete")
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
edit: [
|
|
62
|
+
{
|
|
63
|
+
// Confirm edit
|
|
64
|
+
label: captions.confirm,
|
|
65
|
+
class: CONFIRM_CLASS,
|
|
66
|
+
part: BUTTON_CONFIRM_PART(disabledPart),
|
|
67
|
+
event: this.confirmAction("edit")
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
// Cancel edit
|
|
71
|
+
label: captions.cancel,
|
|
72
|
+
class: CANCEL_CLASS,
|
|
73
|
+
part: BUTTON_CANCEL_PART(disabledPart),
|
|
74
|
+
event: this.toggleMode("edit")
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
normal: [
|
|
78
|
+
{
|
|
79
|
+
// Edit action
|
|
80
|
+
label: captions.edit,
|
|
81
|
+
class: "button-primary button-edit",
|
|
82
|
+
part: `${PART_PREFIX}button-primary edit${disabledPart}`,
|
|
83
|
+
event: this.toggleMode("edit")
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
// Delete action
|
|
87
|
+
label: captions.delete,
|
|
88
|
+
class: "button-primary button-delete",
|
|
89
|
+
part: `${PART_PREFIX}button-primary delete${disabledPart}`,
|
|
90
|
+
event: this.toggleMode("delete")
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
this.lastEditInfo = { name: "", type: "ATT" };
|
|
95
|
+
this.focusInputInNextRender = false;
|
|
96
|
+
this.expanded = false;
|
|
97
|
+
// Modes
|
|
98
|
+
this.errorType = "None";
|
|
99
|
+
this.waitingMode = "none";
|
|
100
|
+
/**
|
|
101
|
+
* This attribute lets you specify if the actions in the `mode === "add"` are
|
|
102
|
+
* visible.
|
|
103
|
+
*/
|
|
104
|
+
this.actionsVisible = true;
|
|
105
|
+
/**
|
|
106
|
+
* The dataType of the field.
|
|
107
|
+
*/
|
|
108
|
+
this.dataType = "";
|
|
109
|
+
/**
|
|
110
|
+
* This attribute lets you specify if the element is disabled.
|
|
111
|
+
* If disabled, it will not fire any user interaction related event.
|
|
112
|
+
*/
|
|
113
|
+
this.disabled = false;
|
|
114
|
+
/**
|
|
115
|
+
* This property maps entities of the current dataModel with their
|
|
116
|
+
* corresponding ATTs.
|
|
117
|
+
*/
|
|
118
|
+
this.entityNameToATTs = {};
|
|
119
|
+
/**
|
|
120
|
+
* This property specifies the defined field names of the entity parent.
|
|
121
|
+
*/
|
|
122
|
+
this.fieldNames = [];
|
|
123
|
+
/**
|
|
124
|
+
* This property specifies at which collection level the field is located.
|
|
125
|
+
*/
|
|
126
|
+
this.level = 1;
|
|
127
|
+
/**
|
|
128
|
+
* Determine the maximum amount of ATTs displayed per entity.
|
|
129
|
+
*/
|
|
130
|
+
this.maxAtts = 3;
|
|
131
|
+
/**
|
|
132
|
+
* This attribute specifies the operating mode of the control
|
|
133
|
+
*/
|
|
134
|
+
this.mode = "normal";
|
|
135
|
+
/**
|
|
136
|
+
* The name of the field.
|
|
137
|
+
*/
|
|
138
|
+
this.name = "";
|
|
139
|
+
/**
|
|
140
|
+
* This attribute indicates that the user cannot modify the value of the control.
|
|
141
|
+
* Same as [readonly](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
|
|
142
|
+
* attribute for `input` elements.
|
|
143
|
+
*/
|
|
144
|
+
this.readonly = false;
|
|
145
|
+
/**
|
|
146
|
+
* `true` to show the new field button when `mode === "add"`
|
|
147
|
+
*/
|
|
148
|
+
this.showNewFieldBtn = true;
|
|
149
|
+
/**
|
|
150
|
+
* The type of the field.
|
|
151
|
+
*/
|
|
152
|
+
this.type = "LEVEL";
|
|
153
|
+
/**
|
|
154
|
+
* Returns:
|
|
155
|
+
* @example ```(Scorer, Goals)```
|
|
156
|
+
* @example ```(Name, Age, Nationality (+3))```
|
|
157
|
+
*/
|
|
158
|
+
this.makeAttsPrettier = (atts, maxAtts) => atts.length <= maxAtts
|
|
159
|
+
? "(" + atts.join(", ") + ")"
|
|
160
|
+
: `(${atts.slice(0, maxAtts).join(", ")} (+${atts.length - maxAtts}))`;
|
|
161
|
+
this.emitDelete = (event) => {
|
|
162
|
+
// The subitem is the last one of the parent. Delete the parent instead
|
|
163
|
+
if (this.level !== 0 && this.fieldNames.length === 1) {
|
|
164
|
+
const parentItem = this.el.parentElement
|
|
165
|
+
.parentElement;
|
|
166
|
+
parentItem.delete(event);
|
|
167
|
+
this.mode = "normal";
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
this.waitingMode = "deleting";
|
|
172
|
+
this.deleteField.emit();
|
|
173
|
+
};
|
|
174
|
+
this.toggleMode = (mode) => (event) => {
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
this.mode = this.mode === "normal" ? mode : "normal";
|
|
177
|
+
this.focusInputInNextRender = mode === "edit";
|
|
178
|
+
};
|
|
179
|
+
this.toggleShowNewField = (event) => {
|
|
180
|
+
event.stopPropagation();
|
|
181
|
+
this.errorType = "None";
|
|
182
|
+
const showNewFieldBtn = !this.showNewFieldBtn;
|
|
183
|
+
this.showNewFieldBtn = showNewFieldBtn;
|
|
184
|
+
this.focusInputInNextRender = !showNewFieldBtn;
|
|
185
|
+
if (!showNewFieldBtn && this.level === 0) {
|
|
186
|
+
const entityItem = this.el.firstElementChild
|
|
187
|
+
.firstElementChild;
|
|
188
|
+
entityItem.clearInput();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* @todo TODO: Improve typing
|
|
193
|
+
* WA function to get the gx-edit's input value
|
|
194
|
+
* @param editElement An HTMLGxEditElement that is implemented in the web-controls-library
|
|
195
|
+
*/
|
|
196
|
+
this.getGxEditInputValue = (editElement) => editElement.shadowRoot.firstElementChild.value;
|
|
197
|
+
this.handleKeyDown = (actionType) => (event) => {
|
|
198
|
+
if (event.code !== KEY_CODES.ENTER) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
this.confirmAction(actionType)(event);
|
|
203
|
+
};
|
|
204
|
+
this.checkChildErrors = (errors, event) => {
|
|
205
|
+
this.el.firstElementChild
|
|
206
|
+
.firstElementChild.checkErrors(errors, event);
|
|
207
|
+
};
|
|
208
|
+
this.validateErrorsWhenAddingEntity = (actionType, errors = "unknown", event) => {
|
|
209
|
+
// Validate child errors when adding a new entity
|
|
210
|
+
if (this.level === 0 && actionType === "new" && errors === "unknown") {
|
|
211
|
+
this.checkChildErrors(errors, event);
|
|
212
|
+
}
|
|
213
|
+
// Validate parent errors when adding a new field in the new entity
|
|
214
|
+
else if (!this.actionsVisible && errors === "unknown") {
|
|
215
|
+
this.firstNewFieldErrors.emit();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
this.confirmAction = (actionType, errors = "unknown", itemInfo = null) => (event) => {
|
|
219
|
+
event.stopPropagation();
|
|
220
|
+
const trimmedInput = this.getGxEditInputValue(this.inputName).trim();
|
|
221
|
+
// Force re-render. Useful when the error type don't change but the
|
|
222
|
+
// displayed error text must change
|
|
223
|
+
this.errorType = "None";
|
|
224
|
+
if (trimmedInput === "") {
|
|
225
|
+
this.errorType = "Empty";
|
|
226
|
+
this.validateErrorsWhenAddingEntity(actionType, errors, event);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
// The field already exists
|
|
230
|
+
if (this.name !== trimmedInput &&
|
|
231
|
+
this.fieldNames.includes(trimmedInput)) {
|
|
232
|
+
this.errorType = "AlreadyDefined";
|
|
233
|
+
this.errorName = trimmedInput;
|
|
234
|
+
this.validateErrorsWhenAddingEntity(actionType, errors, event);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// New field
|
|
238
|
+
if (actionType === "new") {
|
|
239
|
+
this.lastEditInfo = {
|
|
240
|
+
name: trimmedInput,
|
|
241
|
+
type: this.level === 0 ? "ATT" : this.inputType.value // Doesn't matter the type when level = 0
|
|
242
|
+
};
|
|
243
|
+
// Adding a entity
|
|
244
|
+
if (this.level === 0) {
|
|
245
|
+
// Must check child errors
|
|
246
|
+
if (errors === "unknown") {
|
|
247
|
+
this.checkChildErrors(errors, event);
|
|
248
|
+
}
|
|
249
|
+
// The child does not have errors, commit the new entity
|
|
250
|
+
else if (errors === "no") {
|
|
251
|
+
this.waitingMode = "adding";
|
|
252
|
+
this.expanded = true;
|
|
253
|
+
this.newEntity.emit({ name: trimmedInput, level: [itemInfo] });
|
|
254
|
+
this.toggleShowNewField(event);
|
|
255
|
+
this.el.firstElementChild
|
|
256
|
+
.firstElementChild.setAddingMode(); // TODO: Improve typing
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// Normal case: Adding a field that is not the first field of the entity
|
|
260
|
+
else if (this.actionsVisible) {
|
|
261
|
+
this.waitingMode = "adding";
|
|
262
|
+
this.newField.emit(this.lastEditInfo);
|
|
263
|
+
this.toggleShowNewField(event);
|
|
264
|
+
}
|
|
265
|
+
// Adding a field that is the first field of the entity
|
|
266
|
+
else {
|
|
267
|
+
this.firstNewField.emit(this.lastEditInfo);
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// Edit field (level 0 fields don't have a type, because they are always entities)
|
|
272
|
+
if (this.name !== trimmedInput ||
|
|
273
|
+
(this.level !== 0 && this.type !== this.inputType.value)) {
|
|
274
|
+
this.waitingMode = "editing";
|
|
275
|
+
this.lastEditInfo = {
|
|
276
|
+
name: trimmedInput,
|
|
277
|
+
type: this.level === 0 ? "ATT" : this.inputType.value // Doesn't matter the type when level = 0
|
|
278
|
+
};
|
|
279
|
+
this.editField.emit(this.lastEditInfo);
|
|
280
|
+
}
|
|
281
|
+
this.toggleMode("edit")(event);
|
|
282
|
+
};
|
|
283
|
+
this.loading = () => (h("svg", { class: "waiting-mode__loading", height: "28", viewBox: "6 6 12 12" }, h("circle", { cx: "12", cy: "12", r: "4", "stroke-width": "1.125" })));
|
|
284
|
+
this.errorText = (errorTexts) => (h("p", { class: "error-text", part: `${PART_PREFIX}error-text` }, this.errorType === "Empty"
|
|
285
|
+
? errorTexts.Empty
|
|
286
|
+
: [
|
|
287
|
+
this.level === 0
|
|
288
|
+
? errorTexts.AlreadyDefinedEntity1
|
|
289
|
+
: errorTexts.AlreadyDefined1,
|
|
290
|
+
h("span", { part: `${PART_PREFIX}error-text-name` }, this.errorName),
|
|
291
|
+
errorTexts.AlreadyDefined2
|
|
292
|
+
]));
|
|
293
|
+
this.readonlyContent = (captions, name, type) => [
|
|
294
|
+
// Readonly
|
|
295
|
+
h("h1", { id: NAME, class: {
|
|
296
|
+
name: true,
|
|
297
|
+
"name-entity": type === "ENTITY"
|
|
298
|
+
}, part: `${PART_PREFIX}name` }, name),
|
|
299
|
+
this.level !== 0 && type !== "ATT" && (h("span", { class: "type", part: type === "LEVEL" ? `${PART_PREFIX}collection` : `${PART_PREFIX}entity` }, type === "LEVEL"
|
|
300
|
+
? captions.collection
|
|
301
|
+
: this.makeAttsPrettier(this.entityNameToATTs[this.dataType] || [], this.maxAtts)))
|
|
302
|
+
];
|
|
303
|
+
this.editableContent = (actionType, captions, disabledPart, errorPart) => [
|
|
304
|
+
// Editable
|
|
305
|
+
h("gx-edit", { class: "field-name", part: `${PART_PREFIX}input${errorPart}${disabledPart}`, disabled: this.disabled, type: "text", value: this.name, ref: el => (this.inputName = el), onKeydown: this.handleKeyDown(actionType) }),
|
|
306
|
+
this.level !== 0 && (h("div", { class: "select-wrapper" }, h("select", { class: "select", part: `${PART_PREFIX}input${disabledPart} select`, disabled: this.disabled, ref: el => (this.inputType = el) }, h("option", { part: SELECT_OPTION_PART, value: "ATT", selected: this.type === "ATT" }, captions.ATT), h("option", { part: SELECT_OPTION_PART, value: "ENTITY", selected: this.type === "ENTITY" }, captions.ENTITY), h("option", { part: SELECT_OPTION_PART, value: "LEVEL", selected: this.type === "LEVEL" }, captions.LEVEL)))),
|
|
307
|
+
this.errorType !== "None" && this.errorText(this.errorTexts)
|
|
308
|
+
];
|
|
309
|
+
this.newFieldMode = (captions, errorPart, disabledPart, actions) => this.showNewFieldBtn ? (h("button", { class: "button-new-entity", part: `${PART_PREFIX}button-new-entity${disabledPart}`, disabled: this.disabled, type: "button", onClick: this.toggleShowNewField }, this.level === 0 ? captions.addNewEntity : captions.addNewField)) : (h("div", { slot: this.level === 0 ? "header" : undefined, class: {
|
|
310
|
+
[`add-new-field--level-${this.level}`]: true,
|
|
311
|
+
"add-new-field--no-actions": !this.actionsVisible
|
|
312
|
+
}, part: `${PART_PREFIX}header-content`, tabindex: this.level !== 0 && this.actionsVisible ? "0" : undefined }, this.level === 2 && (h("div", { "aria-hidden": "true", class: "sub-field", part: `${PART_PREFIX}sub-field` })), h("h1", { class: "name", part: `${PART_PREFIX}name` }, this.level === 0 ? captions.newEntity : captions.newField), this.editableContent("new", captions, disabledPart, errorPart), this.level === 0 && h("slot", null), this.actionsVisible && [
|
|
313
|
+
h("button", { "aria-label": actions[0].label, class: actions[0].class, part: actions[0].part, disabled: this.disabled, type: "button", onClick: actions[0].event }),
|
|
314
|
+
h("button", { "aria-label": actions[1].label, class: actions[1].class, part: actions[1].part, disabled: this.disabled, type: "button", onClick: actions[1].event })
|
|
315
|
+
]));
|
|
316
|
+
this.normalMode = (captions, errorPart, disabledPart, waitingModePart, actions, showWaitingModeTexts) => [
|
|
317
|
+
h("div", { slot: this.level === 0 ? "header" : undefined, class: {
|
|
318
|
+
header: true,
|
|
319
|
+
"edit-mode": this.mode === "edit"
|
|
320
|
+
}, part: `${PART_PREFIX}header-content`, tabindex: this.level !== 0 ? "0" : undefined }, this.level === 2 && (h("div", { "aria-hidden": "true", class: "sub-field", part: `${PART_PREFIX}sub-field` })), this.mode === "edit"
|
|
321
|
+
? this.editableContent("edit", captions, disabledPart, errorPart)
|
|
322
|
+
: this.readonlyContent(captions, showWaitingModeTexts ? this.lastEditInfo.name : this.name, showWaitingModeTexts ? this.lastEditInfo.type : this.type), !this.readonly && this.actionsVisible && (h("div", { class: {
|
|
323
|
+
"delete-mode": this.mode === "delete",
|
|
324
|
+
optimization: this.mode !== "delete",
|
|
325
|
+
"waiting-mode": this.waitingMode !== "none"
|
|
326
|
+
}, part: `${PART_PREFIX}delete-mode${waitingModePart}` }, this.waitingMode === "none"
|
|
327
|
+
? [
|
|
328
|
+
this.mode === "delete" && captions.deleteMode,
|
|
329
|
+
h("button", { "aria-label": actions[0].label, class: actions[0].class, part: actions[0].part, disabled: this.disabled, type: "button", onClick: actions[0].event }),
|
|
330
|
+
h("button", { "aria-label": actions[1].label, class: actions[1].class, part: actions[1].part, disabled: this.disabled, type: "button", onClick: actions[1].event })
|
|
331
|
+
]
|
|
332
|
+
: [captions[this.waitingMode], this.loading()]))),
|
|
333
|
+
this.type === "LEVEL" &&
|
|
334
|
+
(this.level === 0 ? (h("div", { slot: "content", part: `${PART_PREFIX}content` }, h("slot", null))) : (h("slot", null)))
|
|
335
|
+
];
|
|
336
|
+
}
|
|
337
|
+
handleExpandedChange(event) {
|
|
338
|
+
event.stopPropagation();
|
|
339
|
+
}
|
|
340
|
+
handleFirstNewField(event) {
|
|
341
|
+
if (this.level !== 0) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
this.confirmAction("new", "no", event.detail)(event);
|
|
345
|
+
}
|
|
346
|
+
handleFirstNewFieldErrors(event) {
|
|
347
|
+
this.confirmAction("new", "yes")(event);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Set the adding mode for the first field of the entity.
|
|
351
|
+
*/
|
|
352
|
+
async setAddingMode() {
|
|
353
|
+
this.clearInput();
|
|
354
|
+
this.waitingMode = "adding";
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Remove the value of the input when mode === "add" | "edit"
|
|
358
|
+
*/
|
|
359
|
+
async clearInput() {
|
|
360
|
+
if (this.inputName) {
|
|
361
|
+
const inputRef = this.inputName.shadowRoot
|
|
362
|
+
.firstElementChild; // TODO: Improve typing
|
|
363
|
+
inputRef.value = "";
|
|
364
|
+
}
|
|
365
|
+
this.errorType = "None";
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Check errors in the item when `level !== 0`
|
|
369
|
+
*/
|
|
370
|
+
async checkErrors(errors, event) {
|
|
371
|
+
this.confirmAction("new", errors)(event);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Deletes the field.
|
|
375
|
+
*/
|
|
376
|
+
async delete(event) {
|
|
377
|
+
this.emitDelete(event);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Hides the waiting mode to continue editing the field.
|
|
381
|
+
*/
|
|
382
|
+
async hideWaitingMode() {
|
|
383
|
+
if (this.mode === "add" && this.level === 0) {
|
|
384
|
+
const entityItem = this.el.firstElementChild
|
|
385
|
+
.firstElementChild;
|
|
386
|
+
entityItem.hideWaitingMode();
|
|
387
|
+
}
|
|
388
|
+
// The add mode should not be changed
|
|
389
|
+
else if (this.mode !== "add") {
|
|
390
|
+
this.mode = "normal";
|
|
391
|
+
}
|
|
392
|
+
this.waitingMode = "none";
|
|
393
|
+
}
|
|
394
|
+
componentDidUpdate() {
|
|
395
|
+
// Focus the edit input when the render method has finished
|
|
396
|
+
if (this.focusInputInNextRender && this.inputName) {
|
|
397
|
+
this.focusInputInNextRender = false;
|
|
398
|
+
// Wait until the gx-edit control has render
|
|
399
|
+
requestAnimationFrame(() => {
|
|
400
|
+
this.inputName.click(); // The click method focuses the inner input of the gx-edit
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
render() {
|
|
405
|
+
// Parts
|
|
406
|
+
const disabledPart = this.disabled ? " disabled" : "";
|
|
407
|
+
const waitingModePart = this.waitingMode === "none" ? "" : ` ${PART_PREFIX}waiting-mode`;
|
|
408
|
+
const errorPart = this.errorType !== "None" ? " error" : "";
|
|
409
|
+
const captions = this.captions;
|
|
410
|
+
const actions = this.actions(captions, disabledPart)[this.mode];
|
|
411
|
+
const showWaitingModeTexts = this.waitingMode === "editing" || this.waitingMode === "adding";
|
|
412
|
+
return (h(Host, { role: "listitem", "aria-labelledby": NAME, class: {
|
|
413
|
+
"gx-disabled": this.disabled
|
|
414
|
+
} },
|
|
415
|
+
// Add new field layout (last cell of the collection/entity)
|
|
416
|
+
this.mode === "add" && this.waitingMode !== "adding" ? (this.newFieldMode(captions, errorPart, disabledPart, actions)) : this.level === 0 ? ( // Normal mode. Level === 0
|
|
417
|
+
h("ch-accordion", { class: "accordion", part: `${PART_PREFIX}accordion`, accessibleName: this.name, expanded: this.expanded, exportparts: `accordion__chevron:${PART_PREFIX}chevron,accordion__expandable:${PART_PREFIX}expandable,accordion__header:${PART_PREFIX}header` }, this.normalMode(captions, errorPart, disabledPart, waitingModePart, actions, showWaitingModeTexts))) : (
|
|
418
|
+
// Normal mode. Level !== 0
|
|
419
|
+
this.normalMode(captions, errorPart, disabledPart, waitingModePart, actions, showWaitingModeTexts))));
|
|
420
|
+
}
|
|
421
|
+
get el() { return this; }
|
|
422
|
+
static get style() { return nextDataModelingItemCss; }
|
|
423
|
+
}, [1, "ch-next-data-modeling-item", {
|
|
424
|
+
"actionsVisible": [4, "actions-visible"],
|
|
425
|
+
"captions": [16],
|
|
426
|
+
"dataType": [1, "data-type"],
|
|
427
|
+
"disabled": [4],
|
|
428
|
+
"entityNameToATTs": [16],
|
|
429
|
+
"errorTexts": [16],
|
|
430
|
+
"fieldNames": [16],
|
|
431
|
+
"level": [2],
|
|
432
|
+
"maxAtts": [2, "max-atts"],
|
|
433
|
+
"mode": [1025],
|
|
434
|
+
"name": [1],
|
|
435
|
+
"readonly": [4],
|
|
436
|
+
"showNewFieldBtn": [1028, "show-new-field-btn"],
|
|
437
|
+
"type": [1],
|
|
438
|
+
"expanded": [32],
|
|
439
|
+
"errorType": [32],
|
|
440
|
+
"waitingMode": [32],
|
|
441
|
+
"setAddingMode": [64],
|
|
442
|
+
"clearInput": [64],
|
|
443
|
+
"checkErrors": [64],
|
|
444
|
+
"delete": [64],
|
|
445
|
+
"hideWaitingMode": [64]
|
|
446
|
+
}, [[0, "expandedChange", "handleExpandedChange"], [0, "firstNewField", "handleFirstNewField"], [0, "firstNewFieldErrors", "handleFirstNewFieldErrors"]]]);
|
|
447
|
+
function defineCustomElement() {
|
|
448
|
+
if (typeof customElements === "undefined") {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const components = ["ch-next-data-modeling-item", "ch-accordion"];
|
|
452
|
+
components.forEach(tagName => { switch (tagName) {
|
|
453
|
+
case "ch-next-data-modeling-item":
|
|
454
|
+
if (!customElements.get(tagName)) {
|
|
455
|
+
customElements.define(tagName, NextDataModelingSubitem);
|
|
456
|
+
}
|
|
457
|
+
break;
|
|
458
|
+
case "ch-accordion":
|
|
459
|
+
if (!customElements.get(tagName)) {
|
|
460
|
+
defineCustomElement$1();
|
|
461
|
+
}
|
|
462
|
+
break;
|
|
463
|
+
} });
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export { NextDataModelingSubitem as N, defineCustomElement as d };
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
3
|
const nextDataModelingCss = "ch-next-data-modeling{--delete-icon:url('data:image/svg+xml,<svg width=\"14\" height=\"16\" viewBox=\"0 0 14 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M1.87729 4.55154H12.1585V14.3936C12.1613 14.8186 11.9944 15.2273 11.6949 15.5288C11.3953 15.8304 10.9878 16 10.5627 16H3.47304C3.04797 16 2.64046 15.8304 2.34089 15.5288C2.04133 15.2273 1.87447 14.8186 1.87729 14.3936V4.55154ZM10.5734 1.42436V1.25301C10.5676 0.559264 10.0035 0 9.30972 0H4.72605C4.03228 0 3.46821 0.559264 3.46233 1.25301V1.42436H0.078125V3.03079H14.0005V1.42436H10.5734Z\" fill=\"%23000\"/></svg>');--edit-icon:url('data:image/svg+xml,<svg width=\"17\" height=\"16\" viewBox=\"0 0 17 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.4291 5.4137L10.8838 1.73151L12.0517 0.50411C12.3715 0.168037 12.7644 0 13.2304 0C13.6964 0 14.089 0.168037 14.4082 0.50411L15.5761 1.73151C15.8958 2.06758 16.0627 2.47321 16.0766 2.94838C16.0905 3.42356 15.9376 3.82889 15.6178 4.16438L14.4291 5.4137ZM13.2195 6.70685L4.37728 16H0.832031V12.274L9.67429 2.98082L13.2195 6.70685Z\" fill=\"%23000\"/></svg>');display:grid;grid-template-columns:1fr;grid-auto-rows:min-content;flex:1;height:100%}";
|
|
4
4
|
|
|
5
|
-
const NextDataModeling = class {
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
5
|
+
const NextDataModeling = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
8
9
|
}
|
|
9
10
|
render() {
|
|
10
11
|
return (h(Host, { role: "list" }, h("slot", null)));
|
|
11
12
|
}
|
|
12
|
-
}
|
|
13
|
-
|
|
13
|
+
static get style() { return nextDataModelingCss; }
|
|
14
|
+
}, [4, "ch-next-data-modeling"]);
|
|
15
|
+
function defineCustomElement() {
|
|
16
|
+
if (typeof customElements === "undefined") {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const components = ["ch-next-data-modeling"];
|
|
20
|
+
components.forEach(tagName => { switch (tagName) {
|
|
21
|
+
case "ch-next-data-modeling":
|
|
22
|
+
if (!customElements.get(tagName)) {
|
|
23
|
+
customElements.define(tagName, NextDataModeling);
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
} });
|
|
27
|
+
}
|
|
14
28
|
|
|
15
|
-
export { NextDataModeling as
|
|
29
|
+
export { NextDataModeling as N, defineCustomElement as d };
|
|
@@ -2,12 +2,12 @@ import { proxyCustomElement, HTMLElement, createEvent, h, writeTask, Host } from
|
|
|
2
2
|
import { m as mouseEventModifierKey } from './helpers.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './checkbox.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const treeViewItemCss = ":where(button){all:unset;display:flex;user-select:none;touch-action:manipulation;-webkit-user-drag:element}*,::before,::after{box-sizing:border-box}:host{--checkbox-size:1em;--expandable-button-width:0.75em;--ch-tree-x-list-item-dashed-line--offset:0px;--tab-width:calc(\n var(--checkbox-size) + var(--expandable-button-width) +\n (5px * 2)\n );display:grid;grid-template-rows:min-content;overflow:hidden}.header{--own-offset:0px;display:flex;align-items:center;min-height:calc(1em + 6px);padding-inline-start:var(--padding-inline-start)}.header--disabled{opacity:0.5;pointer-events:none}.header--even{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--even-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--even-expandable+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--odd-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd-expandable+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--level-0{--padding-inline-start:0px}.header--level-0+.expandable{--parent-padding-inline-start--even:0px}.header--expandable-offset{--own-offset:calc(\n var(--expandable-button-width) + 5px\n )}.header--expandable-offset+.expandable{--parent-expandable-offset:calc(var(--expandable-button-width) / 2)}.header--checkbox-offset+.expandable{--parent-checkbox-offset:calc(var(--checkbox-size) / 2);--parent-negative-checkbox-offset:calc(var(--checkbox-size) / 2)}.dashed-line{position:absolute;inset-inline-start:calc( var(--inset-inline-start) + var(--ch-tree-x-list-item-dashed-line--offset) );height:1px;width:calc( var(--tab-width) - var(--parent-checkbox-offset) - var(--parent-expandable-offset) - var(--own-offset) - var(--ch-tree-x-list-item-dashed-line--offset) - 4px );border:0 dashed color-mix(in srgb, currentColor 65%, transparent);border-block-end-width:1px;pointer-events:none;content-visibility:hidden;z-index:1}.last-all-line{inset-block-start:0;height:calc(100% - var(--distance-to-checkbox));border-inline-start-width:1px;border-end-start-radius:2px}.last-line{inset-block-start:0;height:100%;border-inline-start-width:1px;border-style:solid;border-block-end:unset}.expandable-button{display:grid;place-items:center;width:var(--expandable-button-width);height:var(--expandable-button-width);margin-inline-end:5px;z-index:1;cursor:pointer;content-visibility:auto;contain-intrinsic-size:auto var(--expandable-button-width)}.expandable-button::before{content:\"\";width:calc(100% - 2px);height:calc(100% - 2px);background-color:currentColor;-webkit-mask-size:calc(var(--expandable-button-width) - 2px)}.expandable-button--collapsed::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H8.54v5.61h-1V8.5H1.93v-1H7.54V1.89h1V7.5h5.61Z\"/></svg>')}.expandable-button--expanded::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H1.93v-1H14.15Z\"/></svg>')}.expandable-button:focus-visible{outline:1px solid #000}.checkbox{margin-inline-end:5px}.checkbox::part(container){width:var(--checkbox-size);height:var(--checkbox-size)}.action{display:grid;grid-template:\"left-img text right-img\"/max-content 1fr max-content;align-items:center;height:100%;flex:1;cursor:pointer}.readonly-mode{padding-block:0.75px}.left-img,.right-img{display:block;width:0.875em;height:0.875em;content-visibility:auto;contain-intrinsic-size:auto 0.875em}.left-img{grid-area:left-img;margin-inline-end:5px}.right-img{grid-area:right-img;margin-inline-start:5px}.edit-name{grid-area:text;width:100%;height:100%;padding:0;margin:0;background-color:unset;color:unset;border:1px solid currentColor;font:unset;outline:unset}.downloading{width:0.75em;height:0.75em;margin-inline-start:8px;border:2px solid currentColor;border-inline-start-color:transparent;border-radius:50%;opacity:0.75;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.expandable{--parent-expandable-offset:0px;--parent-negative-checkbox-offset:0px;--parent-checkbox-offset:0px;display:grid;grid-auto-rows:min-content;position:relative;content-visibility:auto;contain-intrinsic-size:auto 100px}.expandable--collapsed{display:none;overflow:hidden;content-visibility:hidden}";
|
|
6
6
|
|
|
7
7
|
const resetDragImage = new Image();
|
|
8
8
|
const INITIAL_LEVEL = 0;
|
|
9
9
|
// Selectors
|
|
10
|
-
const TREE_ITEM_TAG_NAME = "ch-tree-
|
|
10
|
+
const TREE_ITEM_TAG_NAME = "ch-tree-view-item";
|
|
11
11
|
const DIRECT_TREE_ITEM_CHILDREN = `:scope>${TREE_ITEM_TAG_NAME}`;
|
|
12
12
|
const FIRST_ENABLED_SUB_ITEM = `${TREE_ITEM_TAG_NAME}:not([disabled])`;
|
|
13
13
|
const LAST_SUB_ITEM = `:scope>${TREE_ITEM_TAG_NAME}:last-child`;
|
|
@@ -26,7 +26,7 @@ const CHECKBOX_EXPORT_PARTS = [
|
|
|
26
26
|
]
|
|
27
27
|
.map(getCheckboxExportPart)
|
|
28
28
|
.join(",");
|
|
29
|
-
const
|
|
29
|
+
const ChTreeViewItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
32
|
this.__registerHost();
|
|
@@ -586,8 +586,8 @@ const ChTreeXListItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
586
586
|
"selected": ["handleSelectedChange"],
|
|
587
587
|
"showLines": ["handleShowLinesChange"]
|
|
588
588
|
}; }
|
|
589
|
-
static get style() { return
|
|
590
|
-
}, [1, "ch-tree-
|
|
589
|
+
static get style() { return treeViewItemCss; }
|
|
590
|
+
}, [1, "ch-tree-view-item", {
|
|
591
591
|
"caption": [1],
|
|
592
592
|
"checkbox": [4],
|
|
593
593
|
"checked": [1540],
|
|
@@ -623,11 +623,11 @@ function defineCustomElement() {
|
|
|
623
623
|
if (typeof customElements === "undefined") {
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
|
-
const components = ["ch-tree-
|
|
626
|
+
const components = ["ch-tree-view-item", "ch-checkbox"];
|
|
627
627
|
components.forEach(tagName => { switch (tagName) {
|
|
628
|
-
case "ch-tree-
|
|
628
|
+
case "ch-tree-view-item":
|
|
629
629
|
if (!customElements.get(tagName)) {
|
|
630
|
-
customElements.define(tagName,
|
|
630
|
+
customElements.define(tagName, ChTreeViewItem);
|
|
631
631
|
}
|
|
632
632
|
break;
|
|
633
633
|
case "ch-checkbox":
|
|
@@ -638,4 +638,4 @@ function defineCustomElement() {
|
|
|
638
638
|
} });
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
-
export {
|
|
641
|
+
export { ChTreeViewItem as C, defineCustomElement as d };
|