native-document 1.0.139 → 1.0.141
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/components.js +1 -1
- package/devtools/ComponentRegistry.js +3 -2
- package/dist/native-document.components.min.css +1 -0
- package/dist/native-document.components.min.js +11639 -8757
- package/dist/native-document.dev.js +2645 -2166
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.js +1 -0
- package/package.json +5 -2
- package/rollup.config.js +5 -2
- package/src/components/$traits/has-draggable/HasDraggable.js +69 -0
- package/src/components/$traits/has-draggable/has-draggable.css +8 -0
- package/src/components/$traits/{HasItems.js → has-items/HasItems.js} +2 -11
- package/src/components/$traits/has-position/HasFullPosition.js +51 -0
- package/src/components/$traits/has-position/HasPosition.js +23 -0
- package/src/components/$traits/has-resizable/HasResizable.js +113 -0
- package/src/components/$traits/has-resizable/has-resizable.css +121 -0
- package/src/components/$traits/has-validation/HasValidation.js +86 -0
- package/src/components/BaseComponent.js +82 -7
- package/src/components/accordion/Accordion.js +37 -31
- package/src/components/accordion/AccordionItem.js +14 -21
- package/src/components/alert/Alert.js +48 -40
- package/src/components/avatar/Avatar.js +4 -3
- package/src/components/avatar/AvatarGroup.js +8 -2
- package/src/components/badge/Badge.js +7 -7
- package/src/components/base-component.css +0 -0
- package/src/components/breadcrumb/BreadCrumb.js +30 -21
- package/src/components/button/Button.js +3 -14
- package/src/components/context-menu/ContextMenu.js +49 -26
- package/src/components/dropdown/Dropdown.js +172 -34
- package/src/components/dropdown/DropdownDivider.js +4 -3
- package/src/components/dropdown/DropdownGroup.js +19 -19
- package/src/components/dropdown/DropdownItem.js +24 -18
- package/src/components/dropdown/helpers.js +52 -0
- package/src/components/form/FormControl.js +207 -108
- package/src/components/form/field/Field.js +106 -174
- package/src/components/form/field/FieldCollection.js +110 -203
- package/src/components/form/field/types/AutocompleteField.js +26 -5
- package/src/components/form/field/types/CheckboxField.js +4 -4
- package/src/components/form/field/types/CheckboxGroupField.js +11 -5
- package/src/components/form/field/types/ColorField.js +4 -4
- package/src/components/form/field/types/DateField.js +110 -18
- package/src/components/form/field/types/EmailField.js +2 -2
- package/src/components/form/field/types/FileField.js +87 -21
- package/src/components/form/field/types/HiddenField.js +4 -4
- package/src/components/form/field/types/ImageField.js +4 -4
- package/src/components/form/field/types/NumberField.js +5 -5
- package/src/components/form/field/types/PasswordField.js +28 -6
- package/src/components/form/field/types/RadioField.js +12 -8
- package/src/components/form/field/types/RangeField.js +29 -5
- package/src/components/form/field/types/SearchField.js +4 -4
- package/src/components/form/field/types/SelectField.js +75 -8
- package/src/components/form/field/types/StringField.js +4 -4
- package/src/components/form/field/types/TelField.js +4 -4
- package/src/components/form/field/types/TextAreaField.js +7 -5
- package/src/components/form/field/types/TimeField.js +52 -6
- package/src/components/form/field/types/UrlField.js +4 -5
- package/src/components/form/field/types/file-field-mode/FileAvatarMode.js +104 -0
- package/src/components/form/field/types/file-field-mode/FileDropzoneMode.js +59 -0
- package/src/components/form/field/types/file-field-mode/FileItemPreview.js +74 -0
- package/src/components/form/field/types/file-field-mode/FileNativeMode.js +21 -0
- package/src/components/form/field/types/file-field-mode/FileUploadButtonMode.js +59 -0
- package/src/components/form/field/types/file-field-mode/FileWallMode.js +53 -0
- package/src/components/form/index.js +14 -2
- package/src/components/form/validation/Validation.js +9 -0
- package/src/components/list/List.js +1 -1
- package/src/components/list/ListGroup.js +1 -1
- package/src/components/menu/HasMenuItem.js +133 -0
- package/src/components/menu/Menu.js +47 -56
- package/src/components/menu/MenuGroup.js +36 -8
- package/src/components/menu/MenuItem.js +24 -10
- package/src/components/menu/MenuLink.js +2 -0
- package/src/components/modal/Modal.js +153 -23
- package/src/components/pagination/Pagination.js +55 -21
- package/src/components/popover/Popover.js +127 -40
- package/src/components/progress/Progress.js +14 -24
- package/src/components/skeleton/Skeleton.js +36 -13
- package/src/components/slider/Slider.js +96 -70
- package/src/components/spinner/Spinner.js +4 -2
- package/src/components/splitter/Splitter.js +15 -8
- package/src/components/splitter/SplitterGutter.js +28 -7
- package/src/components/splitter/SplitterPanel.js +9 -15
- package/src/components/splitter/index.js +3 -1
- package/src/components/stacks/AbsoluteStack.js +33 -0
- package/src/components/stacks/FixedStack.js +33 -0
- package/src/components/stacks/PositionStack.js +146 -0
- package/src/components/stacks/RelativeStack.js +33 -0
- package/src/components/{layouts → stacks}/Stack.js +22 -3
- package/src/components/{layouts → stacks}/index.js +6 -4
- package/src/components/stepper/Stepper.js +159 -67
- package/src/components/stepper/StepperStep.js +49 -12
- package/src/components/switch/Switch.js +59 -29
- package/src/components/switch/index.js +6 -0
- package/src/components/table/Column.js +26 -24
- package/src/components/table/ColumnGroup.js +4 -13
- package/src/components/table/DataTable.js +388 -103
- package/src/components/table/SimpleTable.js +31 -140
- package/src/components/tabs/Tabs.js +142 -44
- package/src/components/toast/Toast.js +40 -35
- package/src/components/tooltip/Tooltip.js +152 -35
- package/src/core/data/ObservableArray.js +94 -30
- package/src/core/data/ObservableChecker.js +20 -75
- package/src/core/data/ObservableItem.js +35 -3
- package/src/core/data/observable-helpers/computed.js +2 -1
- package/src/core/data/observable-helpers/object.js +13 -8
- package/src/core/data/observable-helpers/observable.is-to.js +196 -0
- package/src/core/elements/anchor/anchor.js +3 -2
- package/src/core/elements/control/for-each-array.js +44 -30
- package/src/core/elements/control/for-each.js +6 -3
- package/src/core/elements/control/show-if.js +11 -6
- package/src/core/elements/control/switch.js +2 -1
- package/src/core/elements/index.js +1 -1
- package/src/core/elements/svg.js +61 -0
- package/src/core/utils/HasEventEmitter.js +6 -0
- package/src/core/utils/debug-manager.js +2 -5
- package/src/core/utils/filters/standard.js +2 -1
- package/src/core/utils/property-accumulator.js +35 -6
- package/src/core/utils/shortcut-manager.js +242 -0
- package/src/core/utils/validator.js +1 -1
- package/src/core/wrappers/AttributesWrapper.js +41 -4
- package/src/core/wrappers/DocumentObserver.js +0 -1
- package/src/core/wrappers/HtmlElementWrapper.js +1 -1
- package/src/core/wrappers/NDElement.js +15 -2
- package/src/core/wrappers/SvgElementWrapper.js +15 -0
- package/src/core/wrappers/prototypes/attributes-extensions.js +4 -1
- package/src/core/wrappers/prototypes/nd-element-extensions.js +8 -1
- package/src/router/Router.js +0 -1
- package/src/ui/components/accordion/AccordionItemRender.js +63 -0
- package/src/ui/components/accordion/AccordionRender.js +34 -0
- package/src/ui/components/accordion/accordion.css +121 -0
- package/src/ui/components/alert/AlertRender.js +80 -0
- package/src/ui/components/alert/alert.css +163 -0
- package/src/ui/components/avatar/avata-group/AvatarGroupRender.js +49 -0
- package/src/ui/components/avatar/avata-group/avatar-group.css +38 -0
- package/src/ui/components/avatar/avatar/AvatarRender.js +87 -0
- package/src/ui/components/avatar/avatar/avatar.css +189 -0
- package/src/ui/components/badge/BadgeRender.js +24 -0
- package/src/ui/components/badge/badge.css +168 -0
- package/src/ui/components/breadcrumb/BreadcrumbRender.js +43 -0
- package/src/ui/components/breadcrumb/breadcrumb.css +55 -0
- package/src/ui/components/button/ButtonRender.js +65 -0
- package/src/ui/components/button/button.css +288 -354
- package/src/ui/components/contextmenu/ContextmenuRender.js +70 -0
- package/src/ui/components/contextmenu/contextmenu.css +36 -0
- package/src/ui/components/divider/DividerRender.js +70 -0
- package/src/ui/components/divider/divider.css +70 -0
- package/src/ui/components/dropdown/DropdownRender.js +92 -0
- package/src/ui/components/dropdown/divider/DropdownDividerRender.js +9 -0
- package/src/ui/components/dropdown/divider/dropdown-divider.css +0 -0
- package/src/ui/components/dropdown/dropdown.css +179 -0
- package/src/ui/components/dropdown/group/DropdownGroupRender.js +23 -0
- package/src/ui/components/dropdown/group/dropdown-group.css +0 -0
- package/src/ui/components/dropdown/item/DropdownItemRender.js +29 -0
- package/src/ui/components/dropdown/item/dropdown-item.css +0 -0
- package/src/ui/components/form/FieldCollectionRender.js +110 -0
- package/src/ui/components/form/FormControlRender.js +84 -0
- package/src/ui/components/form/field-collection.css +55 -0
- package/src/ui/components/form/fields/AutocompleteFieldRender.js +143 -0
- package/src/ui/components/form/fields/CheckboxFieldRender.js +59 -0
- package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +92 -0
- package/src/ui/components/form/fields/ColorFieldRender.js +30 -0
- package/src/ui/components/form/fields/DateFieldRender.js +154 -0
- package/src/ui/components/form/fields/EmailFieldRender.js +5 -0
- package/src/ui/components/form/fields/FieldRender.js +117 -0
- package/src/ui/components/form/fields/FileFieldRender.js +41 -0
- package/src/ui/components/form/fields/HiddenFieldRender.js +14 -0
- package/src/ui/components/form/fields/ImageFieldRender.js +0 -0
- package/src/ui/components/form/fields/NumberFieldRender.js +52 -0
- package/src/ui/components/form/fields/PasswordFieldRender.js +65 -0
- package/src/ui/components/form/fields/RadioFieldRender.js +77 -0
- package/src/ui/components/form/fields/RangeFieldRender.js +121 -0
- package/src/ui/components/form/fields/SelectFieldRender.js +248 -0
- package/src/ui/components/form/fields/SliderFieldRender.js +359 -0
- package/src/ui/components/form/fields/StringFieldRender.js +6 -0
- package/src/ui/components/form/fields/TelFieldRender.js +6 -0
- package/src/ui/components/form/fields/TextAreaFieldRender.js +96 -0
- package/src/ui/components/form/fields/TimeFieldRender.js +141 -0
- package/src/ui/components/form/fields/UrlFieldRender.js +6 -0
- package/src/ui/components/form/fields/date-field.css +32 -0
- package/src/ui/components/form/fields/field.css +402 -0
- package/src/ui/components/form/fields/file-field.css +79 -0
- package/src/ui/components/form/fields/password-field.css +50 -0
- package/src/ui/components/form/fields/range-field.css +120 -0
- package/src/ui/components/form/fields/slider.css +195 -0
- package/src/ui/components/form/file-upload-mode/FileAvatarModeRender.js +143 -0
- package/src/ui/components/form/file-upload-mode/FileDropzoneModeRender.js +108 -0
- package/src/ui/components/form/file-upload-mode/FileNativeModeRender.js +22 -0
- package/src/ui/components/form/file-upload-mode/FileUploadButtonModeRender.js +89 -0
- package/src/ui/components/form/file-upload-mode/FileWallModeRender.js +91 -0
- package/src/ui/components/form/file-upload-mode/file-avatar-mode.css +139 -0
- package/src/ui/components/form/file-upload-mode/file-dropzone-mode.css +88 -0
- package/src/ui/components/form/file-upload-mode/file-upload-button-mode.css +44 -0
- package/src/ui/components/form/file-upload-mode/file-wall-mode.css +88 -0
- package/src/ui/components/form/form-control.css +40 -0
- package/src/ui/components/form/helpers.js +112 -0
- package/src/ui/components/form/index.js +61 -0
- package/src/ui/components/menu/MenuDividerRender.js +12 -0
- package/src/ui/components/menu/MenuGroupRender.js +60 -0
- package/src/ui/components/menu/MenuItemRender.js +57 -0
- package/src/ui/components/menu/MenuLinkRender.js +55 -0
- package/src/ui/components/menu/MenuRender.js +21 -0
- package/src/ui/components/menu/helpers.js +121 -0
- package/src/ui/components/menu/menu.css +308 -0
- package/src/ui/components/modal/ModalRender.js +119 -0
- package/src/ui/components/modal/modal.css +156 -0
- package/src/ui/components/pagination/PaginationRender.js +112 -0
- package/src/ui/components/pagination/pagination.css +63 -0
- package/src/ui/components/popover/PopoverRender.js +234 -0
- package/src/ui/components/popover/popover.css +139 -0
- package/src/ui/components/progress/ProgressRender.js +168 -0
- package/src/ui/components/progress/progress.css +197 -0
- package/src/ui/components/skeleton/SkeletonRender.js +79 -0
- package/src/ui/components/skeleton/skeleton.css +154 -0
- package/src/ui/components/spinner/SpinnerRender.js +46 -0
- package/src/ui/components/spinner/spinner.css +152 -0
- package/src/ui/components/splitter/SplitterGutterRender.js +94 -0
- package/src/ui/components/splitter/SplitterPanelRender.js +38 -0
- package/src/ui/components/splitter/SplitterRender.js +74 -0
- package/src/ui/components/splitter/splitter.css +128 -0
- package/src/ui/components/stacks/PositionStackRender.js +38 -0
- package/src/ui/components/stacks/StackRender.js +42 -0
- package/src/ui/components/stacks/absolute-stack/AbsoluteStackRender.js +5 -0
- package/src/ui/components/stacks/fixed-stack/FixedStackRender.js +5 -0
- package/src/ui/components/stacks/h-stack/HStackRender.js +7 -0
- package/src/ui/components/stacks/h-stack/h-stack.css +4 -0
- package/src/ui/components/stacks/index.js +15 -0
- package/src/ui/components/stacks/position-stack.css +62 -0
- package/src/ui/components/stacks/relative-stack/RelativeStackRender.js +7 -0
- package/src/ui/components/stacks/relative-stack/relative-stack.css +3 -0
- package/src/ui/components/stacks/stack.css +78 -0
- package/src/ui/components/stacks/v-stack/VStackRender.js +5 -0
- package/src/ui/components/stacks/v-stack/v-stack.css +4 -0
- package/src/ui/components/stepper/StepperRender.js +70 -0
- package/src/ui/components/stepper/StepperStepRender.js +67 -0
- package/src/ui/components/stepper/stepper.css +359 -0
- package/src/ui/components/switch/SwitchRender.js +82 -0
- package/src/ui/components/switch/switch.css +143 -0
- package/src/ui/components/table/data-table/DataTableRender.js +49 -0
- package/src/ui/components/table/data-table/bulk-actions.js +35 -0
- package/src/ui/components/table/data-table/data-table.css +246 -0
- package/src/ui/components/table/data-table/pagination.js +56 -0
- package/src/ui/components/table/data-table/tables.js +367 -0
- package/src/ui/components/table/data-table/toolbar.js +67 -0
- package/src/ui/components/table/simple-table/SimpleTableRender.js +191 -0
- package/src/ui/components/table/simple-table/simple-table.css +50 -0
- package/src/ui/components/tabs/TabsRender.js +226 -0
- package/src/ui/components/tabs/tabs.css +253 -0
- package/src/ui/components/toast/ToastRender.js +98 -0
- package/src/ui/components/toast/toast.css +201 -0
- package/src/ui/components/tooltip/TooltipRender.js +8 -0
- package/src/ui/components/tooltip/tooltip.css +113 -0
- package/src/ui/index.js +82 -0
- package/src/ui/tokens/colors-dark.scss +2 -1
- package/src/ui/tokens/reset.scss +3 -0
- package/types/control-flow.d.ts +2 -2
- package/src/components/layouts/ZStack.js +0 -41
- package/src/ui/components/button/button.render.js +0 -63
- /package/src/components/{layouts → stacks}/HStack.js +0 -0
- /package/src/components/{layouts → stacks}/VStack.js +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import DebugManager from "../../core/utils/debug-manager";
|
|
3
|
+
import { HStack, VStack } from "../stacks/index";
|
|
4
|
+
import {Div} from "../../core/elements/index";
|
|
3
5
|
|
|
4
6
|
export default function Skeleton(props = {}) {
|
|
5
7
|
if (!(this instanceof Skeleton)) {
|
|
@@ -26,7 +28,7 @@ BaseComponent.extends(Skeleton);
|
|
|
26
28
|
Skeleton.defaultTemplate = null;
|
|
27
29
|
|
|
28
30
|
Skeleton.use = function(template) {
|
|
29
|
-
Skeleton.defaultTemplate = template
|
|
31
|
+
Skeleton.defaultTemplate = template;
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
Skeleton.preset = function(name, callback) {
|
|
@@ -117,21 +119,42 @@ Skeleton.prototype.repeat = function(times) {
|
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
|
|
120
|
-
Skeleton.
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
Skeleton.card = function(type) {
|
|
123
|
+
return VStack([
|
|
124
|
+
Skeleton().type('image').height(200),
|
|
125
|
+
VStack([
|
|
126
|
+
Skeleton().text(1),
|
|
127
|
+
Skeleton().text(2),
|
|
128
|
+
]).spacing('cozy')
|
|
129
|
+
], { class: 'skeleton-card '+type }).spacing('cozy');
|
|
123
130
|
};
|
|
124
131
|
|
|
132
|
+
Skeleton.list = function(items = 3) {
|
|
133
|
+
return VStack(
|
|
134
|
+
Array.from({length: items}, () =>
|
|
135
|
+
HStack([
|
|
136
|
+
Div({ class: 'skeleton-list-item-avatar' }, Skeleton().circle().size(40, 40)),
|
|
137
|
+
Div({ class: 'skeleton-list-item-text' }, Skeleton().text(2)),
|
|
138
|
+
], { class: 'skeleton-list-item' }).spacing('comfortable').alignCenter()
|
|
139
|
+
)
|
|
140
|
+
).spacing('comfortable');
|
|
141
|
+
};
|
|
125
142
|
|
|
126
|
-
Skeleton.
|
|
143
|
+
Skeleton.table = function(rows = 5, cols = 4) {
|
|
144
|
+
const buildRow = () =>
|
|
145
|
+
HStack(
|
|
146
|
+
Array.from({length: cols}, () =>
|
|
147
|
+
Div({ class: 'skeleton-table-col' }, Skeleton().rect().height(16))
|
|
148
|
+
),
|
|
149
|
+
{ class: 'skeleton-table-row' }
|
|
150
|
+
).spacing('comfortable').alignCenter();
|
|
127
151
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
152
|
+
return VStack([
|
|
153
|
+
buildRow(),
|
|
154
|
+
...Array.from({length: rows}, () => buildRow())
|
|
155
|
+
]).spacing('cozy');
|
|
131
156
|
};
|
|
132
157
|
|
|
133
|
-
|
|
134
|
-
Skeleton.
|
|
135
|
-
|
|
136
|
-
Skeleton.table = function(rows = 5, cols = 4) {}; // Preset pour tableau
|
|
137
|
-
Skeleton.paragraph = function(lines = 3) {}; // Preset pour paragraphe
|
|
158
|
+
Skeleton.paragraph = function(lines = 3) {
|
|
159
|
+
return Skeleton().text(lines);
|
|
160
|
+
};
|
|
@@ -1,51 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
1
|
+
import Field from "../form/field/Field";
|
|
3
2
|
|
|
4
|
-
export default function Slider(
|
|
5
|
-
if
|
|
6
|
-
return new Slider(
|
|
3
|
+
export default function Slider(name, props = {}) {
|
|
4
|
+
if(!(this instanceof Slider)) {
|
|
5
|
+
return new Slider(props);
|
|
7
6
|
}
|
|
8
7
|
|
|
8
|
+
Field.call(this, props);
|
|
9
|
+
|
|
9
10
|
this.$description = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
name,
|
|
12
|
+
id: name || null,
|
|
13
|
+
value: null,
|
|
14
|
+
defaultValue: null,
|
|
15
|
+
valueStart: null,
|
|
16
|
+
valueEnd: null,
|
|
17
|
+
range: false,
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 100,
|
|
20
|
+
step: 1,
|
|
21
|
+
showValue: null,
|
|
22
|
+
showTooltip: null,
|
|
18
23
|
tooltipFormat: null,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
renderTooltip: null,
|
|
25
|
+
marks: null,
|
|
26
|
+
showMarks: null,
|
|
27
|
+
variant: null,
|
|
28
|
+
color: null,
|
|
29
|
+
trackColor: null,
|
|
30
|
+
fillColor: null,
|
|
31
|
+
vertical: false,
|
|
32
|
+
height: null,
|
|
33
|
+
disabled: null,
|
|
34
|
+
readonly: null,
|
|
35
|
+
reverse: false,
|
|
36
|
+
snapToMarks: false,
|
|
37
|
+
renderCursor: null,
|
|
38
|
+
renderThumb: null,
|
|
39
|
+
props
|
|
33
40
|
};
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
Slider.prototype = Object.create(Field.prototype);
|
|
44
|
+
Slider.prototype.constructor = Slider;
|
|
45
|
+
|
|
37
46
|
|
|
38
|
-
Slider.use = function(template) {};
|
|
39
47
|
Slider.defaultTemplate = null;
|
|
48
|
+
Slider.use = function(template) {
|
|
49
|
+
Slider.defaultTemplate = template;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
Slider.prototype.model = function(observable) {
|
|
53
|
+
this.$description.value = observable;
|
|
54
|
+
return this;
|
|
55
|
+
};
|
|
40
56
|
|
|
57
|
+
Slider.prototype.modelStart = function(observable) {
|
|
58
|
+
this.$description.valueStart = observable;
|
|
59
|
+
return this;
|
|
60
|
+
};
|
|
41
61
|
|
|
42
|
-
Slider.prototype.
|
|
43
|
-
this.$description.
|
|
62
|
+
Slider.prototype.modelEnd = function(observable) {
|
|
63
|
+
this.$description.valueEnd = observable;
|
|
44
64
|
return this;
|
|
45
65
|
};
|
|
46
66
|
|
|
47
|
-
Slider.prototype.
|
|
48
|
-
|
|
67
|
+
Slider.prototype.defaultValue = function(value) {
|
|
68
|
+
this.$description.defaultValue = value;
|
|
69
|
+
return this;
|
|
49
70
|
};
|
|
50
71
|
|
|
51
72
|
Slider.prototype.setCurrentStep = function(value) {
|
|
@@ -54,8 +75,8 @@ Slider.prototype.setCurrentStep = function(value) {
|
|
|
54
75
|
return this;
|
|
55
76
|
};
|
|
56
77
|
|
|
57
|
-
Slider.prototype.range = function(
|
|
58
|
-
this.$description.range =
|
|
78
|
+
Slider.prototype.range = function(enabled = true) {
|
|
79
|
+
this.$description.range = enabled;
|
|
59
80
|
return this;
|
|
60
81
|
};
|
|
61
82
|
|
|
@@ -89,6 +110,11 @@ Slider.prototype.tooltipFormat = function(formatFn) {
|
|
|
89
110
|
return this;
|
|
90
111
|
};
|
|
91
112
|
|
|
113
|
+
Slider.prototype.renderTooltip = function(renderFn) {
|
|
114
|
+
this.$description.renderTooltip = renderFn;
|
|
115
|
+
return this;
|
|
116
|
+
};
|
|
117
|
+
|
|
92
118
|
Slider.prototype.marks = function(marks) {
|
|
93
119
|
this.$description.marks = marks;
|
|
94
120
|
return this;
|
|
@@ -99,28 +125,42 @@ Slider.prototype.showMarks = function(enabled = true) {
|
|
|
99
125
|
return this;
|
|
100
126
|
};
|
|
101
127
|
|
|
128
|
+
Slider.prototype.snapToMarks = function(enabled = true) {
|
|
129
|
+
this.$description.snapToMarks = enabled;
|
|
130
|
+
return this;
|
|
131
|
+
};
|
|
132
|
+
|
|
102
133
|
Slider.prototype.variant = function(name) {
|
|
103
134
|
this.$description.variant = name;
|
|
104
135
|
return this;
|
|
105
136
|
};
|
|
106
137
|
|
|
107
|
-
Slider.prototype.primary
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
Slider.prototype.
|
|
111
|
-
return this.variant('
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
|
|
138
|
+
Slider.prototype.primary = function() { return this.variant('primary'); };
|
|
139
|
+
Slider.prototype.secondary = function() { return this.variant('secondary'); };
|
|
140
|
+
Slider.prototype.success = function() { return this.variant('success'); };
|
|
141
|
+
Slider.prototype.warning = function() { return this.variant('warning'); };
|
|
142
|
+
Slider.prototype.danger = function() { return this.variant('danger'); };
|
|
143
|
+
Slider.prototype.info = function() { return this.variant('info'); };
|
|
144
|
+
|
|
145
|
+
Slider.prototype.color = function(color) {
|
|
146
|
+
this.$description.color = color;
|
|
147
|
+
return this;
|
|
115
148
|
};
|
|
116
|
-
|
|
117
|
-
|
|
149
|
+
|
|
150
|
+
Slider.prototype.trackColor = function(color) {
|
|
151
|
+
this.$description.trackColor = color;
|
|
152
|
+
return this;
|
|
118
153
|
};
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
|
|
155
|
+
Slider.prototype.fillColor = function(color) {
|
|
156
|
+
this.$description.fillColor = color;
|
|
157
|
+
return this;
|
|
121
158
|
};
|
|
122
|
-
|
|
123
|
-
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Slider.prototype.fullColor = function(color) {
|
|
162
|
+
this.color(color).fillColor(color);
|
|
163
|
+
return this;
|
|
124
164
|
};
|
|
125
165
|
|
|
126
166
|
Slider.prototype.vertical = function(enabled = true) {
|
|
@@ -148,8 +188,13 @@ Slider.prototype.reverse = function(enabled = true) {
|
|
|
148
188
|
return this;
|
|
149
189
|
};
|
|
150
190
|
|
|
151
|
-
Slider.prototype.
|
|
152
|
-
this.$description.
|
|
191
|
+
Slider.prototype.renderThumb = function(renderFn) {
|
|
192
|
+
this.$description.renderThumb = renderFn;
|
|
193
|
+
return this;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
Slider.prototype.renderCursor = function(renderFn) {
|
|
197
|
+
this.$description.renderCursor = renderFn;
|
|
153
198
|
return this;
|
|
154
199
|
};
|
|
155
200
|
|
|
@@ -161,23 +206,4 @@ Slider.prototype.onChange = function(handler) {
|
|
|
161
206
|
Slider.prototype.onComplete = function(handler) {
|
|
162
207
|
this.on('complete', handler);
|
|
163
208
|
return this;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Slider.prototype.renderCursor = function(renderFn) {
|
|
168
|
-
this.$description.renderCursor = renderFn;
|
|
169
|
-
return this;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
Slider.prototype.render = function(renderFn) {
|
|
173
|
-
this.$description.render = renderFn;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Slider.prototype.$build = function() {
|
|
178
|
-
// TODO: Implementation
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
Slider.prototype.toNdElement = function() {
|
|
182
|
-
return this.$build();
|
|
183
209
|
};
|
|
@@ -16,8 +16,8 @@ export default function Spinner(props = {}) {
|
|
|
16
16
|
overlay: null,
|
|
17
17
|
backdrop: null,
|
|
18
18
|
render: null,
|
|
19
|
-
loading: null,
|
|
20
19
|
speed: 'normal',
|
|
20
|
+
fullScreenOverlay: null,
|
|
21
21
|
props
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -138,9 +138,11 @@ Spinner.prototype.overlay = function(enabled = true) {
|
|
|
138
138
|
return this;
|
|
139
139
|
};
|
|
140
140
|
Spinner.prototype.fullscreen = function() {
|
|
141
|
+
this.$description.fullScreenOverlay = true;
|
|
141
142
|
return this.overlay(true);
|
|
142
143
|
};
|
|
143
144
|
Spinner.prototype.backdrop = function(enabled = true) {
|
|
145
|
+
this.$description.overlay = true;
|
|
144
146
|
this.$description.backdrop = enabled;
|
|
145
147
|
return this;
|
|
146
148
|
};
|
|
@@ -164,7 +166,7 @@ Spinner.prototype.fast = function() {
|
|
|
164
166
|
return this.speed('fast');
|
|
165
167
|
};
|
|
166
168
|
Spinner.prototype.loading = function(isLoading) {
|
|
167
|
-
this
|
|
169
|
+
this.showIf(isLoading);
|
|
168
170
|
return this;
|
|
169
171
|
};
|
|
170
172
|
Spinner.prototype.bind = Spinner.prototype.loading;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
2
|
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
3
|
import {Validator} from "../../../index";
|
|
4
|
+
import SplitterPanel from "./SplitterPanel";
|
|
4
5
|
|
|
5
|
-
export default function Splitter(
|
|
6
|
+
export default function Splitter(props = {}) {
|
|
6
7
|
if(!(this instanceof Splitter)) {
|
|
7
|
-
return new Splitter(
|
|
8
|
+
return new Splitter(props);
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
BaseComponent.call(this, props);
|
|
12
|
+
|
|
10
13
|
this.$description = {
|
|
11
14
|
orientation: 'horizontal',
|
|
12
15
|
panels: [],
|
|
13
16
|
gutterSize: 8,
|
|
14
17
|
render: null,
|
|
15
|
-
|
|
18
|
+
props
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
this.$element = null;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
BaseComponent.extends(Splitter
|
|
24
|
+
BaseComponent.extends(Splitter);
|
|
25
|
+
BaseComponent.use(Splitter, HasEventEmitter);
|
|
22
26
|
|
|
23
27
|
Splitter.defaultTemplate = null;
|
|
24
28
|
|
|
@@ -51,17 +55,20 @@ Splitter.prototype.gutterSize = function(gutterSize) {
|
|
|
51
55
|
return this;
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
Splitter.prototype.panel = function(
|
|
58
|
+
Splitter.prototype.panel = function(content, options = {}, props = {}) {
|
|
59
|
+
const panel = content instanceof SplitterPanel
|
|
60
|
+
? content
|
|
61
|
+
: SplitterPanel(content).setDescription(options);
|
|
55
62
|
this.$description.panels.push(panel);
|
|
56
63
|
return this;
|
|
57
64
|
};
|
|
58
65
|
|
|
59
66
|
Splitter.prototype.panels = function(panels) {
|
|
60
67
|
if(Validator.isObservable(this.$description.panels)) {
|
|
61
|
-
this.$description.panels.
|
|
62
|
-
|
|
68
|
+
this.$description.panels.clear();
|
|
69
|
+
} else {
|
|
70
|
+
this.$description.panels = [];
|
|
63
71
|
}
|
|
64
|
-
this.$description.panels = [];
|
|
65
72
|
panels.forEach(panel => this.panel(panel));
|
|
66
73
|
return this;
|
|
67
74
|
};
|
|
@@ -1,26 +1,47 @@
|
|
|
1
|
+
import BaseComponent from "../BaseComponent";
|
|
2
|
+
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
3
|
+
import { $ } from '../../../index';
|
|
1
4
|
|
|
2
5
|
|
|
3
|
-
export default function SplitterGutter(leftPanel, rightPanel,
|
|
6
|
+
export default function SplitterGutter(leftPanel, rightPanel, props = {}) {
|
|
4
7
|
if(!(this instanceof SplitterGutter)) {
|
|
5
|
-
return new SplitterGutter(
|
|
8
|
+
return new SplitterGutter(leftPanel, rightPanel, props);
|
|
6
9
|
}
|
|
7
10
|
|
|
11
|
+
BaseComponent.call(this, props);
|
|
12
|
+
|
|
8
13
|
this.$description = {
|
|
9
14
|
leftPanel: leftPanel || null,
|
|
10
15
|
rightPanel: rightPanel || null,
|
|
11
|
-
orientation:
|
|
12
|
-
cursor:
|
|
13
|
-
size:
|
|
14
|
-
isDragging: $(false)
|
|
15
|
-
|
|
16
|
+
orientation: 'horizontal',
|
|
17
|
+
cursor: 'col-resize',
|
|
18
|
+
size: 2,
|
|
19
|
+
isDragging: $(false),
|
|
20
|
+
props
|
|
21
|
+
};
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
BaseComponent.extends(SplitterGutter);
|
|
25
|
+
BaseComponent.use(SplitterGutter, HasEventEmitter);
|
|
26
|
+
|
|
18
27
|
SplitterGutter.defaultTemplate = null;
|
|
19
28
|
|
|
20
29
|
SplitterGutter.use = function(template) {
|
|
21
30
|
SplitterGutter.defaultTemplate = template;
|
|
22
31
|
};
|
|
23
32
|
|
|
33
|
+
SplitterGutter.prototype.vertical = function() {
|
|
34
|
+
this.$description.orientation = 'vertical';
|
|
35
|
+
this.$description.cursor = 'row-resize';
|
|
36
|
+
return this;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
SplitterGutter.prototype.horizontal = function() {
|
|
40
|
+
this.$description.orientation = 'horizontal';
|
|
41
|
+
this.$description.cursor = 'col-resize';
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
SplitterGutter.prototype.panels = function(leftPanel, rightPanel) {
|
|
25
46
|
this.$description.leftPanel = leftPanel;
|
|
26
47
|
this.$description.rightPanel = rightPanel;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import BaseComponent from "../BaseComponent";
|
|
2
|
+
import { $ } from '../../../index';
|
|
2
3
|
|
|
3
|
-
export default function SplitterPanel(content,
|
|
4
|
+
export default function SplitterPanel(content, props = {}) {
|
|
4
5
|
if(!(this instanceof SplitterPanel)) {
|
|
5
|
-
return new SplitterPanel(content,
|
|
6
|
+
return new SplitterPanel(content, props);
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
config = content;
|
|
10
|
-
content = config.content || null;
|
|
11
|
-
}
|
|
9
|
+
BaseComponent.call(this, props);
|
|
12
10
|
|
|
13
11
|
this.$description = {
|
|
12
|
+
orientation: 'horizontal',
|
|
14
13
|
content: content || null,
|
|
15
|
-
size: null,
|
|
14
|
+
size: $(null),
|
|
16
15
|
minSize: null,
|
|
17
16
|
maxSize: null,
|
|
18
17
|
collapsible: false,
|
|
@@ -20,11 +19,11 @@ export default function SplitterPanel(content, config = {}) {
|
|
|
20
19
|
resizable: true,
|
|
21
20
|
data: null,
|
|
22
21
|
render: null,
|
|
23
|
-
|
|
22
|
+
props
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
BaseComponent.extends(SplitterPanel
|
|
26
|
+
BaseComponent.extends(SplitterPanel);
|
|
28
27
|
|
|
29
28
|
SplitterPanel.defaultTemplate = null;
|
|
30
29
|
|
|
@@ -38,7 +37,7 @@ SplitterPanel.prototype.content = function(content) {
|
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
SplitterPanel.prototype.size = function(size) {
|
|
41
|
-
this.$description.size
|
|
40
|
+
this.$description.size.set(size);
|
|
42
41
|
return this;
|
|
43
42
|
};
|
|
44
43
|
|
|
@@ -74,9 +73,4 @@ SplitterPanel.prototype.fixed = function() {
|
|
|
74
73
|
SplitterPanel.prototype.data = function(data) {
|
|
75
74
|
this.$description.data = data;
|
|
76
75
|
return this;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
SplitterPanel.prototype.render = function(renderFn) {
|
|
80
|
-
this.$description.render = renderFn;
|
|
81
|
-
return this;
|
|
82
76
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseComponent from "../BaseComponent";
|
|
2
|
+
import PositionStack from "./PositionStack";
|
|
3
|
+
import DebugManager from "../../core/utils/debug-manager";
|
|
4
|
+
|
|
5
|
+
export default function AbsoluteStack(content, props = {}) {
|
|
6
|
+
if(!(this instanceof AbsoluteStack)) {
|
|
7
|
+
return new AbsoluteStack(content, props);
|
|
8
|
+
}
|
|
9
|
+
PositionStack.call(this, content, props);
|
|
10
|
+
this.$description.position = 'absolute';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
BaseComponent.extends(AbsoluteStack, PositionStack);
|
|
14
|
+
|
|
15
|
+
AbsoluteStack.defaultTemplate = null;
|
|
16
|
+
|
|
17
|
+
AbsoluteStack.use = function(template) {
|
|
18
|
+
AbsoluteStack.defaultTemplate = template;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
AbsoluteStack.preset = function(name, callback) {
|
|
22
|
+
if(AbsoluteStack.prototype[name] || AbsoluteStack[name]) {
|
|
23
|
+
DebugManager.warn(`Warning: the ${name} method already exists in AbsoluteStack.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
AbsoluteStack[name] = (content, props) => callback(new AbsoluteStack(content, props));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
AbsoluteStack.presets = function(presets) {
|
|
30
|
+
for(const name in presets) {
|
|
31
|
+
AbsoluteStack.preset(name, presets[name]);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseComponent from "../BaseComponent";
|
|
2
|
+
import PositionStack from "./PositionStack";
|
|
3
|
+
import DebugManager from "../../core/utils/debug-manager";
|
|
4
|
+
|
|
5
|
+
export default function FixedStack(content, props = {}) {
|
|
6
|
+
if(!(this instanceof FixedStack)) {
|
|
7
|
+
return new FixedStack(content, props);
|
|
8
|
+
}
|
|
9
|
+
PositionStack.call(this, content, props);
|
|
10
|
+
this.$description.position = 'fixed';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
BaseComponent.extends(FixedStack, PositionStack);
|
|
14
|
+
|
|
15
|
+
FixedStack.defaultTemplate = null;
|
|
16
|
+
|
|
17
|
+
FixedStack.use = function(template) {
|
|
18
|
+
FixedStack.defaultTemplate = template;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
FixedStack.preset = function(name, callback) {
|
|
22
|
+
if(FixedStack.prototype[name] || FixedStack[name]) {
|
|
23
|
+
DebugManager.warn(`Warning: the ${name} method already exists in FixedStack.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
FixedStack[name] = (content, props) => callback(new FixedStack(content, props));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
FixedStack.presets = function(presets) {
|
|
30
|
+
for(const name in presets) {
|
|
31
|
+
FixedStack.preset(name, presets[name]);
|
|
32
|
+
}
|
|
33
|
+
};
|