OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
themes
/
silver
/
main
/
ts
/
ui
/
dialog
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:40:48 AM
rwxr-xr-x
📄
AlertDialog.ts
1.7 KB
02/20/2020 06:38:15 AM
rw-r--r--
📄
Autocomplete.ts
1.78 KB
02/20/2020 06:38:15 AM
rw-r--r--
📄
Bar.ts
689 bytes
02/20/2020 06:38:16 AM
rw-r--r--
📄
BodyPanel.ts
2.11 KB
02/20/2020 06:38:16 AM
rw-r--r--
📄
Collection.ts
5.65 KB
02/20/2020 06:38:17 AM
rw-r--r--
📄
ColorInput.ts
5.81 KB
02/20/2020 06:38:17 AM
rw-r--r--
📄
ColorPicker.ts
4.06 KB
02/20/2020 06:38:19 AM
rw-r--r--
📄
ConfirmDialog.ts
2.13 KB
02/20/2020 06:38:19 AM
rw-r--r--
📄
CustomEditor.ts
2.04 KB
02/20/2020 06:38:20 AM
rw-r--r--
📄
Dialogs.ts
3.91 KB
02/20/2020 06:38:20 AM
rw-r--r--
📄
Dropzone.ts
4.89 KB
02/20/2020 06:38:21 AM
rw-r--r--
📄
Grid.ts
735 bytes
02/20/2020 06:38:21 AM
rw-r--r--
📄
IFrame.ts
3.3 KB
02/20/2020 06:38:22 AM
rw-r--r--
📄
Label.ts
1.29 KB
02/20/2020 06:38:22 AM
rw-r--r--
📄
SelectBox.ts
2.37 KB
02/20/2020 06:38:23 AM
rw-r--r--
📄
SizeInput.ts
4.96 KB
02/20/2020 06:38:23 AM
rw-r--r--
📄
TabPanel.ts
5.41 KB
02/20/2020 06:38:24 AM
rw-r--r--
📄
Table.ts
1.52 KB
02/20/2020 06:38:24 AM
rw-r--r--
📄
TextField.ts
4.24 KB
02/20/2020 06:38:25 AM
rw-r--r--
📄
TypeAheadInput.ts
1.31 KB
02/20/2020 06:38:26 AM
rw-r--r--
📄
UrlInput.ts
9.25 KB
02/20/2020 06:38:26 AM
rw-r--r--
📄
WindowManager.ts
6.3 KB
02/20/2020 06:38:27 AM
rw-r--r--
📁
imagetools
-
02/20/2020 06:42:42 AM
rwxr-xr-x
Editing: TabPanel.ts
Close
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import { AddEventsBehaviour, AlloyEvents, AlloyTriggers, Behaviour, Composing, Form as AlloyForm, Keying, Receiving, Representing, SketchSpec, Tabbar as AlloyTabbar, TabSection as AlloyTabSection, Tabstopping, AlloyComponent } from '@ephox/alloy'; import { Objects } from '@ephox/boulder'; import { Arr, Cell, Fun, Merger } from '@ephox/katamari'; import { toValidValues } from 'tinymce/themes/silver/ui/general/FormValues'; import { interpretInForm } from 'tinymce/themes/silver/ui/general/UiFactory'; import { UiFactoryBackstage } from '../../backstage/Backstage'; import { formTabChangeEvent } from '../general/FormEvents'; import NavigableObject from '../general/NavigableObject'; import { setMode } from '../alien/DialogTabHeight'; const SendDataToSectionChannel = 'send-data-to-section'; const SendDataToViewChannel = 'send-data-to-view'; export interface TabPanelFoo<I> { tabs: Array<{ title: string, items: I[]}>; } export type TabData = Record<string, any>; export const renderTabPanel = <I>(spec: TabPanelFoo<I>, backstage: UiFactoryBackstage): SketchSpec => { const storedValue = Cell<TabData>({ }); const updateDataWithForm = (form: AlloyComponent): void => { const formData = Representing.getValue(form); const validData = toValidValues(formData).getOr({ }); const currentData = storedValue.get(); const newData = Merger.deepMerge(currentData, validData); storedValue.set(newData); }; const setDataOnForm = (form: AlloyComponent) => { const tabData = storedValue.get(); Representing.setValue(form, tabData); }; const oldTab = Cell(null); const allTabs = Arr.map(spec.tabs, function (tab) { return { value: tab.title, dom: { tag: 'div', classes: [ 'tox-dialog__body-nav-item' ], innerHtml: backstage.shared.providers.translate(tab.title) }, view () { return [ // Dupe with SilverDialog AlloyForm.sketch((parts) => { return { dom: { tag: 'div', classes: [ 'tox-form' ] }, components: Arr.map(tab.items, (item) => interpretInForm(parts, item, backstage)), formBehaviours: Behaviour.derive([ Keying.config({ mode: 'acyclic', useTabstopAt: Fun.not(NavigableObject.isPseudoStop) }), AddEventsBehaviour.config('TabView.form.events', [ AlloyEvents.runOnAttached(setDataOnForm), AlloyEvents.runOnDetached(updateDataWithForm) ]), Receiving.config({ channels: Objects.wrapAll([ { key: SendDataToSectionChannel, value: { onReceive: updateDataWithForm } }, { key: SendDataToViewChannel, value: { onReceive: setDataOnForm } } ]) }) ]) }; }) ]; } }; }); // Assign fixed height or variable height to the tabs const tabMode = setMode(allTabs).smartTabHeight; return AlloyTabSection.sketch({ dom: { tag: 'div', classes: [ 'tox-dialog__body' ] }, onChangeTab: (section, button, _viewItems) => { const title = Representing.getValue(button); AlloyTriggers.emitWith(section, formTabChangeEvent, { title, oldTitle: oldTab.get() }); oldTab.set(title); }, tabs: allTabs, components: [ AlloyTabSection.parts().tabbar({ dom: { tag: 'div', classes: [ 'tox-dialog__body-nav' ] }, components: [ AlloyTabbar.parts().tabs({ }) ], markers: { tabClass: 'tox-tab', selectedClass: 'tox-dialog__body-nav-item--active' }, tabbarBehaviours: Behaviour.derive([ Tabstopping.config({ }) ]) }), AlloyTabSection.parts().tabview({ dom: { tag: 'div', classes: [ 'tox-dialog__body-content' ] } }) ], selectFirst: tabMode.selectFirst, tabSectionBehaviours: Behaviour.derive([ AddEventsBehaviour.config('tabpanel', tabMode.extraEvents), Keying.config({ mode: 'acyclic' }), // INVESTIGATE: Is this necessary? Probably used by getCompByName. Composing.config({ // TODO: Think about this find: (comp) => Arr.head(AlloyTabSection.getViewItems(comp)) }), Representing.config({ store: { mode: 'manual', getValue: (tsection: AlloyComponent) => { // NOTE: Assumes synchronous updating of store. tsection.getSystem().broadcastOn([ SendDataToSectionChannel ], { }); return storedValue.get(); }, setValue: (tsection: AlloyComponent, value: TabData) => { storedValue.set(value); tsection.getSystem().broadcastOn([ SendDataToViewChannel ], { }); } } }) ]) }); };