@componyx/ui 0.0.0-stage → 1.0.3
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/AppSkin/AppSkin.css +1268 -0
- package/AppSkin/AppSkin.js +2748 -0
- package/AppSkin/Themes/Default.css +241 -0
- package/Base/Base.js +3407 -0
- package/Base/ComponentIcons.css +66 -0
- package/Base/Font/ComponentIcons.woff +0 -0
- package/Base/Font/UI.woff +0 -0
- package/Base/Library.js +8432 -0
- package/Base/NavigationManager.js +462 -0
- package/Base/ResponsiveTemplates.js +371 -0
- package/Base/Sanitizer.js +288 -0
- package/Base/Themes/Default.css +255 -0
- package/Base/UI.css +618 -0
- package/Base/UIResourcePath.js +6 -0
- package/Bindary/Bindary.js +2011 -0
- package/Bindary/Modules/Connection.js +216 -0
- package/Bindary/Modules/Core.js +854 -0
- package/Bindary/Modules/DataUpdater.js +351 -0
- package/Bindary/Modules/ExpressionEngine.js +347 -0
- package/Bindary/Modules/ProxyManager.js +482 -0
- package/Bindary/Modules/Renderer.js +605 -0
- package/Bindary/Modules/Router.js +291 -0
- package/Bindary/Modules/Scroller.js +89 -0
- package/Bindary/Modules/Template.js +1273 -0
- package/BookmarkSpy/BookmarkSpy.js +430 -0
- package/Box/Box.css +36 -0
- package/Box/Box.js +1685 -0
- package/Button/Button.css +470 -0
- package/Button/Button.js +1398 -0
- package/Button/Themes/Default.css +200 -0
- package/Carousel/Carousel.css +273 -0
- package/Carousel/Carousel.js +607 -0
- package/ColorButton/ColorButton.css +39 -0
- package/ColorButton/ColorButton.js +336 -0
- package/ColorPicker/ColorPicker.css +359 -0
- package/ColorPicker/ColorPicker.js +972 -0
- package/ComboBox/ComboBox.css +357 -0
- package/ComboBox/ComboBox.js +2342 -0
- package/ComboBox/Themes/Default.css +23 -0
- package/DataPager/DataPager.css +72 -0
- package/DataPager/DataPager.js +674 -0
- package/DatePicker/DatePicker.css +227 -0
- package/DatePicker/DatePicker.js +1531 -0
- package/DatePicker/Themes/Default.css +26 -0
- package/Dialog/Dialog.css +106 -0
- package/Dialog/Dialog.js +572 -0
- package/Dialog/Themes/Default.css +10 -0
- package/Editor/Data/Emoji.json +8285 -0
- package/Editor/Data/Special.json +1042 -0
- package/Editor/Editor.css +1562 -0
- package/Editor/Editor.js +4058 -0
- package/Editor/Font/Editor.woff +0 -0
- package/Editor/Modules/ComponentFactory.js +565 -0
- package/Editor/Modules/ContentManager.js +748 -0
- package/Editor/Modules/DialogManager.js +1234 -0
- package/Editor/Modules/EventManager.js +458 -0
- package/Editor/Modules/Format.js +950 -0
- package/Editor/Modules/History.js +191 -0
- package/Editor/Modules/LayoutState.js +379 -0
- package/Editor/Modules/ListManager.js +296 -0
- package/Editor/Modules/MenuManager.js +388 -0
- package/Editor/Modules/NodeManager.js +681 -0
- package/Editor/Modules/ParagraphButtons.js +122 -0
- package/Editor/Modules/Resizer.js +176 -0
- package/Editor/Modules/SelectionRange.js +564 -0
- package/Editor/Modules/SourceViewBuilder.js +212 -0
- package/Editor/Modules/SymbolPicker.js +208 -0
- package/Editor/Modules/Table.js +2327 -0
- package/Editor/Modules/TableDialog.js +757 -0
- package/Editor/Modules/Toolbar.js +375 -0
- package/Editor/Modules/TooltipMenu.js +125 -0
- package/Editor/Modules/Utility.js +131 -0
- package/Editor/Themes/Default.css +204 -0
- package/FileUpload/FileUpload.css +156 -0
- package/FileUpload/FileUpload.js +898 -0
- package/FileUpload/Themes/Default.css +17 -0
- package/Form/Form.css +1934 -0
- package/Form/Form.js +4943 -0
- package/Form/Modules/ActionManager.js +368 -0
- package/Form/Modules/BuildPanelManager.js +319 -0
- package/Form/Modules/ComponentFactory.js +468 -0
- package/Form/Modules/ComponentPanel.js +265 -0
- package/Form/Modules/ConfigPanelManager.js +685 -0
- package/Form/Modules/DataObserver.js +717 -0
- package/Form/Modules/Databinder.js +602 -0
- package/Form/Modules/Draggable.js +756 -0
- package/Form/Modules/OptionsPanel.js +342 -0
- package/Form/Modules/Renderer.js +1889 -0
- package/Form/Modules/RuleEngine.js +585 -0
- package/Form/Modules/RulesPanel.js +1158 -0
- package/Form/Modules/Types.js +1709 -0
- package/Form/Modules/ValidationManager.js +194 -0
- package/Form/Themes/Default.css +216 -0
- package/FormField/FormField.css +468 -0
- package/FormField/FormField.js +576 -0
- package/FormField/Themes/Default.css +99 -0
- package/Grid/Grid.css +544 -0
- package/Grid/Grid.js +3761 -0
- package/Grid/Themes/Default.css +43 -0
- package/LICENSE +126 -0
- package/MaskedTextBox/MaskedTextBox.css +28 -0
- package/MaskedTextBox/MaskedTextBox.js +642 -0
- package/MaskedTextBox/Themes/Default.css +6 -0
- package/Menu/Menu.css +328 -0
- package/Menu/Menu.js +2386 -0
- package/Menu/Themes/Default.css +24 -0
- package/NumericBox/NumericBox.css +120 -0
- package/NumericBox/NumericBox.js +984 -0
- package/PanelBar/PanelBar.css +123 -0
- package/PanelBar/PanelBar.js +505 -0
- package/PanelBar/Themes/Default.css +51 -0
- package/PieChart/PieChart.css +95 -0
- package/PieChart/PieChart.js +820 -0
- package/PieChart/Themes/Default.css +9 -0
- package/README.md +178 -3
- package/Slider/Slider.css +348 -0
- package/Slider/Slider.js +1306 -0
- package/Slider/Themes/Default.css +44 -0
- package/TabStrip/TabStrip.css +52 -0
- package/TabStrip/TabStrip.js +362 -0
- package/TabStrip/Themes/Default.css +35 -0
- package/TimePicker/Themes/Default.css +30 -0
- package/TimePicker/TimePicker.css +253 -0
- package/TimePicker/TimePicker.js +1485 -0
- package/TooltipManager/Themes/Default.css +21 -0
- package/TooltipManager/TooltipManager.css +227 -0
- package/TooltipManager/TooltipManager.js +791 -0
- package/Validator/Validator.css +54 -0
- package/Validator/Validator.js +2508 -0
- package/componyx.html-data.json +619 -0
- package/index.js +27 -0
- package/package.json +43 -4
- package/types/AppSkin.d.ts +842 -0
- package/types/Base.d.ts +1034 -0
- package/types/Bindary.d.ts +1196 -0
- package/types/BookmarkSpy.d.ts +112 -0
- package/types/Box.d.ts +374 -0
- package/types/Button.d.ts +455 -0
- package/types/Carousel.d.ts +136 -0
- package/types/ColorButton.d.ts +120 -0
- package/types/ColorPicker.d.ts +225 -0
- package/types/ComboBox.d.ts +507 -0
- package/types/DataPager.d.ts +152 -0
- package/types/DatePicker.d.ts +354 -0
- package/types/Dialog.d.ts +160 -0
- package/types/Editor.d.ts +1289 -0
- package/types/FileUpload.d.ts +206 -0
- package/types/Form.d.ts +3078 -0
- package/types/FormField.d.ts +204 -0
- package/types/Grid.d.ts +911 -0
- package/types/Library.d.ts +1899 -0
- package/types/MaskedTextBox.d.ts +91 -0
- package/types/Menu.d.ts +577 -0
- package/types/NumericBox.d.ts +310 -0
- package/types/PanelBar.d.ts +223 -0
- package/types/PieChart.d.ts +224 -0
- package/types/ResponsiveTemplates.d.ts +108 -0
- package/types/Slider.d.ts +227 -0
- package/types/TabStrip.d.ts +185 -0
- package/types/TimePicker.d.ts +265 -0
- package/types/TooltipManager.d.ts +178 -0
- package/types/UI.d.ts +29 -0
- package/types/Validator.d.ts +653 -0
- package/types/index.d.ts +59 -0
- package/ui.css +11783 -0
- package/ui.js +79477 -0
- package/ui.min.css +138 -0
- package/ui.min.js +264 -0
- package/ui.min.js.map +1 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
|
|
2
|
+
componyx.UI.editor_modules = componyx.UI.editor_modules || {};
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ParagraphButtons module - manages the before/after paragraph insert buttons.
|
|
6
|
+
* @class ParagraphButtons
|
|
7
|
+
* @memberof componyx.UI.editor_modules
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
componyx.UI.editor_modules.ParagraphButtons = class ParagraphButtons
|
|
11
|
+
{
|
|
12
|
+
#buttons = new Map();
|
|
13
|
+
|
|
14
|
+
constructor(editor)
|
|
15
|
+
{
|
|
16
|
+
this.editor = editor;
|
|
17
|
+
this.utility = editor.utility;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
show(editableElement, node)
|
|
21
|
+
{
|
|
22
|
+
let buttons = this.#buttons.get(editableElement),
|
|
23
|
+
container = node.nodeName.match(this.utility.voidNodeRegEx) ? node.parentNode : node,
|
|
24
|
+
scrollValues = this.utility.saveScroll(editableElement);
|
|
25
|
+
|
|
26
|
+
if (!buttons)
|
|
27
|
+
buttons = this.#create(editableElement);
|
|
28
|
+
|
|
29
|
+
let before = buttons.before,
|
|
30
|
+
after = buttons.after;
|
|
31
|
+
|
|
32
|
+
before.remove();
|
|
33
|
+
after.remove();
|
|
34
|
+
|
|
35
|
+
container.appendChild(before);
|
|
36
|
+
container.appendChild(after);
|
|
37
|
+
|
|
38
|
+
let pos = $lib.getPos(node);
|
|
39
|
+
after.style.display = before.style.display = '';
|
|
40
|
+
|
|
41
|
+
$lib.setPos(before, { top: pos.top - (before.offsetHeight / 2), left: pos.left }, true);
|
|
42
|
+
$lib.setPos(after, { top: pos.bottom - (after.offsetHeight / 2), left: pos.right - (after.offsetWidth / 2) }, true);
|
|
43
|
+
|
|
44
|
+
this.utility.resetScroll(editableElement, scrollValues);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
hide()
|
|
48
|
+
{
|
|
49
|
+
for (let [key, value] of this.#buttons)
|
|
50
|
+
{
|
|
51
|
+
value.before.style.display = value.after.style.display = 'none';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
destroy(editableElement)
|
|
56
|
+
{
|
|
57
|
+
const paragraphCssClass = `a.button.${this.editor.getCssClass(this.editor.classOption.PARAGRAPH)}`;
|
|
58
|
+
editableElement.querySelectorAll(`${paragraphCssClass}`).forEach(el => el.remove());
|
|
59
|
+
this.#buttons = new Map();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#create(editableElement)
|
|
63
|
+
{
|
|
64
|
+
let cssClass = `${this.utility.buttonCss} ${this.editor.getThemeCSS()} ${this.editor.getCssClass(this.editor.classOption.PARAGRAPH)}`,
|
|
65
|
+
before = this.#createButton(editableElement, { className: cssClass + ' before' }),
|
|
66
|
+
after = this.#createButton(editableElement, { className: cssClass + ' after' }),
|
|
67
|
+
buttons = { before, after };
|
|
68
|
+
|
|
69
|
+
before.onclick = this.#insert.bind(this, before, true);
|
|
70
|
+
after.onclick = this.#insert.bind(this, after, false);
|
|
71
|
+
|
|
72
|
+
before.contentEditable = false;
|
|
73
|
+
after.contentEditable = false;
|
|
74
|
+
|
|
75
|
+
this.#buttons.set(editableElement, buttons);
|
|
76
|
+
return buttons;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#createButton(container, props)
|
|
80
|
+
{
|
|
81
|
+
return $lib.element(container, '', 'a', '', '', props);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#insert(node, before, e)
|
|
85
|
+
{
|
|
86
|
+
this.editor.activateDocument();
|
|
87
|
+
|
|
88
|
+
let rootNode = this.editor.nodeManager.getRootNode(node, false),
|
|
89
|
+
p = $lib.element('', '', 'p', $lib.element('', '', 'br'));
|
|
90
|
+
|
|
91
|
+
if (before)
|
|
92
|
+
rootNode.parentNode.insertBefore(p, rootNode);
|
|
93
|
+
else
|
|
94
|
+
{
|
|
95
|
+
if (rootNode.nextElementSibling)
|
|
96
|
+
rootNode.parentNode.insertBefore(p, rootNode.nextElementSibling);
|
|
97
|
+
else
|
|
98
|
+
rootNode.parentNode.appendChild(p);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
this.editor.contentManager.setBlockAttr(p);
|
|
102
|
+
|
|
103
|
+
let sel = this.editor.selectionRange.getSelection(),
|
|
104
|
+
range = this.editor.selectionRange.getRange();
|
|
105
|
+
|
|
106
|
+
range.selectNode(p.firstChild);
|
|
107
|
+
range.collapse(true);
|
|
108
|
+
|
|
109
|
+
sel.removeAllRanges();
|
|
110
|
+
sel.addRange(range);
|
|
111
|
+
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
|
|
115
|
+
this.editor.history.addItem();
|
|
116
|
+
this.editor.deactivateDocument();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var ParagraphButtons = componyx.UI.editor_modules.ParagraphButtons;
|
|
121
|
+
|
|
122
|
+
export { ParagraphButtons as default };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
|
|
2
|
+
componyx.UI.editor_modules = componyx.UI.editor_modules || {};
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resizer module — manages the resize handles and ghost overlay for resizable elements.
|
|
6
|
+
* Resizable elements are determined by matcher functions instead of nodeName mapping.
|
|
7
|
+
* @class Resizer
|
|
8
|
+
* @memberof componyx.UI.editor_modules
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
componyx.UI.editor_modules.Resizer = class Resizer
|
|
12
|
+
{
|
|
13
|
+
#resizable = null;
|
|
14
|
+
#resizing = false;
|
|
15
|
+
|
|
16
|
+
constructor(editor)
|
|
17
|
+
{
|
|
18
|
+
this.editor = editor;
|
|
19
|
+
|
|
20
|
+
this.defaultConfig = {
|
|
21
|
+
cssPrefix: 'image-resize'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Matcher list
|
|
25
|
+
this.resizableTypes = [
|
|
26
|
+
{
|
|
27
|
+
filter: node => node.nodeName === 'IMG',
|
|
28
|
+
config: {}
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Returns the currently active resizable instance.
|
|
35
|
+
*/
|
|
36
|
+
get resizable() { return this.#resizable; }
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns true while a drag is in progress.
|
|
40
|
+
*/
|
|
41
|
+
get resizing() { return this.#resizing; }
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns configuration for a node if it is resizable.
|
|
45
|
+
* @param {HTMLElement} node
|
|
46
|
+
* @returns {Object|null}
|
|
47
|
+
*/
|
|
48
|
+
getConfig(node)
|
|
49
|
+
{
|
|
50
|
+
if (!node) return null;
|
|
51
|
+
|
|
52
|
+
const entry = this.resizableTypes.find(m => m.filter(node));
|
|
53
|
+
if (!entry) return null;
|
|
54
|
+
|
|
55
|
+
return Object.assign({}, this.defaultConfig, entry.config);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Attaches resize handles to the specified node if it is resizable.
|
|
60
|
+
* @param {HTMLElement|null} node
|
|
61
|
+
*/
|
|
62
|
+
set(node)
|
|
63
|
+
{
|
|
64
|
+
if (!node || (this.#resizable && this.#resizable.element === node))
|
|
65
|
+
return;
|
|
66
|
+
|
|
67
|
+
this.clear(true);
|
|
68
|
+
|
|
69
|
+
const config = this.getConfig(node);
|
|
70
|
+
if (!config)
|
|
71
|
+
return;
|
|
72
|
+
|
|
73
|
+
const editor = this.editor,
|
|
74
|
+
editableEl = editor.getEditorElement();
|
|
75
|
+
|
|
76
|
+
// Build the four corner handles
|
|
77
|
+
let reHandleTL = $lib.element(editableEl, '', '', '', null, { className: config.cssPrefix + '-handle' }),
|
|
78
|
+
reHandleTR = editableEl.appendChild(reHandleTL.cloneNode(false)),
|
|
79
|
+
reHandleBL = editableEl.appendChild(reHandleTL.cloneNode(false)),
|
|
80
|
+
reHandleBR = editableEl.appendChild(reHandleTL.cloneNode(false)),
|
|
81
|
+
resizeGhost = editableEl.appendChild(node.cloneNode(false));
|
|
82
|
+
|
|
83
|
+
resizeGhost.classList.add(config.cssPrefix + '-ghost');
|
|
84
|
+
resizeGhost.style.display = 'none';
|
|
85
|
+
|
|
86
|
+
reHandleTL.classList.add('nw');
|
|
87
|
+
reHandleTR.classList.add('ne');
|
|
88
|
+
reHandleBL.classList.add('sw');
|
|
89
|
+
reHandleBR.classList.add('se');
|
|
90
|
+
|
|
91
|
+
const setPos = (el) =>
|
|
92
|
+
{
|
|
93
|
+
let pos = $lib.getPos(el);
|
|
94
|
+
$lib.setPos(reHandleTL, { top: pos.top, left: pos.left }, true);
|
|
95
|
+
$lib.setPos(reHandleTR, { top: pos.top, left: pos.right }, true);
|
|
96
|
+
$lib.setPos(reHandleBL, { top: pos.bottom, left: pos.left }, true);
|
|
97
|
+
$lib.setPos(reHandleBR, { top: pos.bottom, left: pos.right }, true);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
setPos(node);
|
|
101
|
+
|
|
102
|
+
const resizeSettings = {
|
|
103
|
+
defaultHandles: false,
|
|
104
|
+
resizeHandles: [{ nw: reHandleTL, ne: reHandleTR }, { sw: reHandleBL, se: reHandleBR }],
|
|
105
|
+
resizeGhost: resizeGhost,
|
|
106
|
+
|
|
107
|
+
onResizeStart: () =>
|
|
108
|
+
{
|
|
109
|
+
this.#resizing = true;
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
onResize: (args) =>
|
|
113
|
+
{
|
|
114
|
+
args.event.preventDefault();
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
onResizeEnd: () =>
|
|
118
|
+
{
|
|
119
|
+
editor.activateDocument();
|
|
120
|
+
|
|
121
|
+
const scrollValues = editor.utility.saveScroll(editableEl);
|
|
122
|
+
setPos(node);
|
|
123
|
+
|
|
124
|
+
editor.history.addItem();
|
|
125
|
+
editor.activateDocument();
|
|
126
|
+
this.set(node);
|
|
127
|
+
editor.paragraphButtons.show(editableEl, node.parentNode);
|
|
128
|
+
editor.utility.resetScroll(editableEl, scrollValues);
|
|
129
|
+
editor.deactivateDocument();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
this.#resizable = $lib.resizable(node, resizeSettings);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Removes the resize handles and ghost overlay.
|
|
138
|
+
* @param {boolean} [force=false]
|
|
139
|
+
* @returns {HTMLElement|undefined}
|
|
140
|
+
*/
|
|
141
|
+
clear(force = false)
|
|
142
|
+
{
|
|
143
|
+
const resizable = this.#resizable,
|
|
144
|
+
range = this.editor.getStoredRange();
|
|
145
|
+
|
|
146
|
+
if (!resizable)
|
|
147
|
+
return;
|
|
148
|
+
|
|
149
|
+
const activeNode = range?.startContainer,
|
|
150
|
+
stillResizable = activeNode
|
|
151
|
+
? resizable.element.contains(activeNode)
|
|
152
|
+
: false;
|
|
153
|
+
|
|
154
|
+
const shouldClear = force || (!this.#resizing && !stillResizable);
|
|
155
|
+
|
|
156
|
+
if (!shouldClear)
|
|
157
|
+
return;
|
|
158
|
+
|
|
159
|
+
const el = resizable.element;
|
|
160
|
+
|
|
161
|
+
const config = this.getConfig(el),
|
|
162
|
+
editableEl = this.editor.getEditorElement();
|
|
163
|
+
|
|
164
|
+
editableEl.querySelectorAll(`.${config.cssPrefix}-ghost,.${config.cssPrefix}-handle`).forEach(el => el.remove());
|
|
165
|
+
|
|
166
|
+
resizable.disable();
|
|
167
|
+
this.#resizable = null;
|
|
168
|
+
this.#resizing = false;
|
|
169
|
+
|
|
170
|
+
return el;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
var Resizer = componyx.UI.editor_modules.Resizer;
|
|
175
|
+
|
|
176
|
+
export { Resizer as default };
|