new UiSortableList({
containerId: instructionListContainer.id,
isSimpleSorting: true,
- options: {
- //TODO toleranceElement: "> div",
- },
+ toleranceElement: "div",
});
if (instructionsData.type === "update") {
new UiSortableList({
containerId: containerId,
- options: {
- //TODO toleranceElement: "> div",
- },
+ toleranceElement: "div",
});
if (this.options.isAjax) {
offset: number;
options: Sortable.Options;
isSimpleSorting: boolean;
+ toleranceElement: string;
additionalParameters: UnknownObject;
}
offset: 0,
options: {
animation: 150,
- chosenClass: "sortablePlaceholder",
- fallbackOnBody: true,
swapThreshold: 0.65,
- filter: (event: Event | TouchEvent, target: HTMLElement, sortable: Sortable) => {
- //TODO
- console.log(event, target, sortable);
- return true;
+ fallbackOnBody: true,
+ chosenClass: "sortablePlaceholder",
+ ghostClass: "",
+ draggable: "li:not(.sortableNoSorting)",
+ toleranceElement: "span",
+ filter: (event: Event | TouchEvent, target: HTMLElement) => {
+ const eventTarget = event.target as HTMLElement;
+ if (eventTarget === target) {
+ return false;
+ }
+ if (eventTarget.parentElement !== target) {
+ return false;
+ }
+
+ return eventTarget.nodeName !== this._options.toleranceElement;
},
- },
+ } as Sortable.Options,
isSimpleSorting: false,
additionalParameters: {},
},
throw new Error(`Container '${this._options.containerId}' not found.`);
}
- new Sortable(this.#container.querySelector(".sortableList")!, this._options.options);
+ if (this._options.isSimpleSorting) {
+ const sortableList = this.#container.querySelector<HTMLElement>(".sortableList")!;
+ if (sortableList.nodeName === "TBODY") {
+ this._options.options.draggable = "tr:not(.sortableNoSorting)";
+ }
+
+ new Sortable(sortableList, {
+ direction: "vertical",
+ ...this._options.options,
+ });
+ } else {
+ this.#container.querySelectorAll(".sortableList").forEach((list: HTMLElement) => {
+ new Sortable(list, {
+ group: "nested",
+ ...this._options.options,
+ });
+ });
+ }
}
}
new UiSortableList({
containerId: '{$option->optionName}SortableList',
- options: {
- toleranceElement: ''
- }
+ toleranceElement: '',
});
// re-select the previously selected tab
new List_1.default({
containerId: instructionListContainer.id,
isSimpleSorting: true,
- options: {
- //TODO toleranceElement: "> div",
- },
+ toleranceElement: "div",
});
if (instructionsData.type === "update") {
document
this.createOptionList(pollOptions || []);
new List_1.default({
containerId: containerId,
- options: {
- //TODO toleranceElement: "> div",
- },
+ toleranceElement: "div",
});
if (this.options.isAjax) {
const element = document.getElementById(this.wysiwygId);
offset: 0,
options: {
animation: 150,
- chosenClass: "sortablePlaceholder",
- fallbackOnBody: true,
swapThreshold: 0.65,
- filter: (event, target, sortable) => {
- console.log(event, target, sortable);
- return true;
+ fallbackOnBody: true,
+ chosenClass: "sortablePlaceholder",
+ ghostClass: "",
+ draggable: "li:not(.sortableNoSorting)",
+ toleranceElement: "span",
+ filter: (event, target) => {
+ const eventTarget = event.target;
+ if (eventTarget === target) {
+ return false;
+ }
+ if (eventTarget.parentElement !== target) {
+ return false;
+ }
+ return eventTarget.nodeName !== this._options.toleranceElement;
},
},
isSimpleSorting: false,
if (!this.#container) {
throw new Error(`Container '${this._options.containerId}' not found.`);
}
- new sortablejs_1.default(this.#container.querySelector(".sortableList"), this._options.options);
+ if (this._options.isSimpleSorting) {
+ const sortableList = this.#container.querySelector(".sortableList");
+ if (sortableList.nodeName === "TBODY") {
+ this._options.options.draggable = "tr:not(.sortableNoSorting)";
+ }
+ new sortablejs_1.default(sortableList, {
+ direction: "vertical",
+ ...this._options.options,
+ });
+ }
+ else {
+ this.#container.querySelectorAll(".sortableList").forEach((list) => {
+ new sortablejs_1.default(list, {
+ group: "nested",
+ ...this._options.options,
+ });
+ });
+ }
}
}
return UiSortableList;
background-color: var(--wcfStatusWarningBackground);
border: 1px solid var(--wcfStatusWarningBorder);
color: var(--wcfStatusWarningText);
- padding: 10px;
&.sortableInvalidTarget {
background-color: var(--wcfStatusErrorBackground);
border-color: var(--wcfStatusErrorBorder);
color: var(--wcfStatusErrorText);
}
+
+
+ .sortableNodeLabel {
+ background-color: transparent;
+ }
}
@include screen-xs {