@kizmann/nano-ui 3.0.0 → 3.0.1
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/nano-ui.css +1 -1
- package/dist/nano-ui.esm.js +1 -1
- package/dist/nano-ui.esm.js.map +1 -1
- package/dist/themes/default.css +1 -1
- package/package.json +3 -3
- package/src/button/js/button/NButtonView.ts +1 -1
- package/src/cascader/css/cascader-panel.scss +1 -1
- package/src/cascader/js/cascader/NCascaderController.ts +32 -16
- package/src/cascader/js/cascader/NCascaderView.ts +1 -1
- package/src/cascader/js/cascader-panel/NCascaderPanelController.ts +55 -24
- package/src/cascader/js/cascader-panel/NCascaderPanelView.ts +10 -9
- package/src/cascader/js/helper/NCascaderHelper.ts +3 -7
- package/src/checkbox/css/checkbox-group.scss +0 -8
- package/src/checkbox/css/checkbox.scss +6 -0
- package/src/checkbox/js/checkbox/NCheckbox.ts +7 -0
- package/src/checkbox/js/checkbox/NCheckboxData.ts +8 -1
- package/src/checkbox/js/checkbox-group/NCheckboxGroup.ts +7 -0
- package/src/checkbox/js/checkbox-group/NCheckboxGroupData.ts +5 -0
- package/src/collapse/css/collapse-item.scss +1 -1
- package/src/collapse/js/collapse-item/NCollapseItem.ts +5 -0
- package/src/collapse/js/collapse-item/NCollapseItemView.ts +6 -3
- package/src/config/js/config/NConfig.ts +5 -0
- package/src/config/js/config/NConfigController.ts +2 -2
- package/src/config/js/config/NConfigView.ts +5 -1
- package/src/draggable/css/draghandler.scss +11 -8
- package/src/draggable/js/drag/NDragIndicator.ts +4 -0
- package/src/draggable/js/drag/NDragReciever.ts +2 -2
- package/src/draggable/js/draglist/NDraglist.ts +6 -0
- package/src/draggable/js/draglist/NDraglistController.ts +157 -24
- package/src/draggable/js/draglist/NDraglistView.ts +43 -12
- package/src/draggable/js/dropzone/NDropzone.ts +14 -0
- package/src/draggable/js/dropzone/NDropzoneController.ts +27 -1
- package/src/draggable/js/dropzone/NDropzoneData.ts +10 -0
- package/src/draggable/js/dropzone/NDropzoneView.ts +3 -7
- package/src/empty/js/empty-icon/NEmptyIcon.ts +1 -1
- package/src/form/js/form/NForm.ts +1 -1
- package/src/form/js/form/NFormController.ts +20 -1
- package/src/form/js/form-bag/NFormBagController.ts +4 -0
- package/src/form/js/form-bag/NFormBagView.ts +2 -1
- package/src/form/js/form-item/NFormItemView.ts +1 -1
- package/src/form/js/form-rules/module/NFormRuleRequiredIf.ts +4 -0
- package/src/form/js/form-rules/module/NFormRuleRequiredUnless.ts +4 -0
- package/src/index.scss +1 -1
- package/src/info/css/info-field.scss +4 -4
- package/src/info/js/info/NInfoView.ts +1 -4
- package/src/info/js/info-column/NInfoColumnView.ts +6 -2
- package/src/input/css/input-number.scss +5 -0
- package/src/input/js/input-number/NInputNumberController.ts +4 -4
- package/src/input/js/textarea/NTextareaView.ts +3 -3
- package/src/modal/css/modal.scss +4 -0
- package/src/modal/js/drawer/NDrawerController.ts +16 -3
- package/src/modal/js/handler/NModalElement.ts +14 -0
- package/src/modal/js/handler/NModalHandler.ts +13 -0
- package/src/modal/js/modal/NModal.ts +7 -0
- package/src/modal/js/modal/NModalController.ts +20 -2
- package/src/modal/js/modal/NModalData.ts +18 -2
- package/src/modal/js/modal/NModalView.ts +7 -9
- package/src/popover/css/popover.scss +5 -10
- package/src/popover/js/handler/NPopoverElement.ts +4 -0
- package/src/popover/js/popover/NPopover.ts +7 -0
- package/src/popover/js/popover/NPopoverController.ts +10 -2
- package/src/popover/js/popover/NPopoverData.ts +5 -0
- package/src/popover/js/popover/NPopoverView.ts +22 -3
- package/src/popover/js/popover-panel/NPopoverPanelController.ts +3 -1
- package/src/preview/css/preview.scss +0 -6
- package/src/preview/js/handler/NPreviewHandler.ts +3 -3
- package/src/preview/js/preview/NPreview.ts +2 -2
- package/src/preview/js/preview/NPreviewController.ts +7 -8
- package/src/preview/js/preview/NPreviewData.ts +8 -1
- package/src/preview/js/preview/NPreviewView.ts +15 -12
- package/src/preview/js/preview-module/NPreviewFileModule.ts +1 -1
- package/src/radio/css/radio-group.scss +0 -8
- package/src/radio/css/radio.scss +6 -0
- package/src/radio/js/radio/NRadio.ts +9 -2
- package/src/radio/js/radio/NRadioData.ts +8 -1
- package/src/radio/js/radio-group/NRadioGroup.ts +9 -2
- package/src/radio/js/radio-group/NRadioGroupData.ts +5 -0
- package/src/resizer/css/resizer.scss +4 -0
- package/src/resizer/js/resizer/NResizerController.ts +5 -1
- package/src/resizer/js/resizer/NResizerData.ts +0 -35
- package/src/resizer/js/resizer/NResizerView.ts +4 -0
- package/src/root/css/helpers.scss +20 -0
- package/src/root/css/tooltip.scss +39 -49
- package/src/root/js/controller/GroupController.ts +1 -1
- package/src/root/js/data/DragData.ts +8 -0
- package/src/root/js/module/Pointer.ts +18 -0
- package/src/root/js/module/Styler.ts +4 -0
- package/src/root/js/prop/BaseProps.ts +33 -0
- package/src/root/js/prop/DragProps.ts +7 -0
- package/src/root/js/proto/ProtoView.ts +5 -2
- package/src/scrollbar/css/scrollbar.scss +6 -1
- package/src/scrollbar/js/handler/NScrollbarElement.ts +4 -0
- package/src/scrollbar/js/virtualbar/NVirtualbar.ts +3 -0
- package/src/scrollbar/js/virtualbar/NVirtualbarController.ts +1 -1
- package/src/scrollbar/js/virtualbar/NVirtualbarView.ts +53 -51
- package/src/select/js/select/NSelectController.ts +3 -1
- package/src/signal/js/alert/NAlertElement.ts +4 -2
- package/src/signal/js/confirm/NConfirmElement.ts +4 -4
- package/src/signal/js/notify/NNotifyElement.ts +1 -1
- package/src/switch/js/switch/NSwitchController.ts +20 -4
- package/src/table/css/table.scss +39 -6
- package/src/table/js/table/NTable.ts +3 -0
- package/src/table/js/table/NTableController.ts +6 -4
- package/src/table/js/table/NTableView.ts +62 -14
- package/src/table/js/table-cell/NTableCellImage.ts +1 -1
- package/src/table/js/table-cell/NTableCellOption.ts +1 -1
- package/src/table/js/table-column/NTableColumn.ts +7 -0
- package/src/table/js/table-column/NTableColumnData.ts +5 -0
- package/src/table/js/table-filter/NTableFilterOption.ts +5 -7
- package/src/table/js/table-filter/NTableFilterString.ts +1 -1
- package/src/tabs/js/tabs/NTabsController.ts +5 -1
- package/src/tabs/js/tabs/NTabsView.ts +4 -0
- package/src/tabs/js/tabs-item/NTabsItemController.ts +17 -3
- package/src/tabs/js/tabs-item/NTabsItemView.ts +12 -9
- package/src/transfer/js/transfer/NTransferController.ts +14 -10
- package/src/transfer/js/transfer/NTransferView.ts +2 -2
- package/src/visuals/css/message.scss +99 -0
- package/src/visuals/css/progress.scss +39 -0
- package/src/visuals/index.scss +2 -0
- package/src/visuals/index.ts +4 -0
- package/src/visuals/js/message/NMessage.ts +65 -0
- package/src/visuals/js/message/NMessageController.ts +96 -0
- package/src/visuals/js/message/NMessageData.ts +43 -0
- package/src/visuals/js/message/NMessageView.ts +101 -0
- package/src/visuals/js/progress/NProgress.ts +63 -0
- package/src/visuals/js/progress/NProgressController.ts +48 -0
- package/src/visuals/js/progress/NProgressData.ts +75 -0
- package/src/visuals/js/progress/NProgressView.ts +48 -0
- package/themes/default/checkbox/src/checkbox/checkbox.scss +13 -0
- package/themes/default/input-number/src/input-number/input-number.scss +6 -13
- package/themes/default/preview/src/preview/preview.scss +11 -2
- package/themes/default/radio/src/radio/radio.scss +13 -0
- package/themes/default/root/vars/colors-dark-bluish.scss +1 -0
- package/themes/default/root/vars/colors-dark.scss +1 -0
- package/themes/default/root/vars/colors-light-bluish.scss +2 -1
- package/themes/default/root/vars/colors-light.scss +2 -1
- package/themes/default/scrollbar/src/scrollbar/scrollbar.scss +1 -1
|
@@ -2,7 +2,7 @@ import { provide, SetupContext } from "vue";
|
|
|
2
2
|
import { GroupController } from "../../../root/index.ts";
|
|
3
3
|
import { NTabsView } from "./NTabsView.ts";
|
|
4
4
|
import { NTabsData } from "./NTabsData.ts";
|
|
5
|
-
import { Arr, Num, Run } from "@kizmann/pico-js";
|
|
5
|
+
import { Arr, Mix, Num, Run } from "@kizmann/pico-js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export class NTabsController extends GroupController
|
|
@@ -108,6 +108,10 @@ export class NTabsController extends GroupController
|
|
|
108
108
|
|
|
109
109
|
updateIndicator()
|
|
110
110
|
{
|
|
111
|
+
if ( this.childs.length < 2 ) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
111
115
|
const [el, pl] = [
|
|
112
116
|
this.dom('indicator'), this.dom('indicator').parent()
|
|
113
117
|
];
|
|
@@ -2,7 +2,7 @@ import { provide, SetupContext } from "vue";
|
|
|
2
2
|
import { ProtoController } from "../../../root/index.ts";
|
|
3
3
|
import { NTabsItemView } from "./NTabsItemView.ts";
|
|
4
4
|
import { NTabsItemData } from "./NTabsItemData.ts";
|
|
5
|
-
import { Arr, Mix } from "@kizmann/pico-js";
|
|
5
|
+
import { Arr, Mix, Run } from "@kizmann/pico-js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export class NTabsItemController extends ProtoController
|
|
@@ -52,6 +52,10 @@ export class NTabsItemController extends ProtoController
|
|
|
52
52
|
'tabs', 'NTabs'
|
|
53
53
|
]);
|
|
54
54
|
|
|
55
|
+
this.injectRef([
|
|
56
|
+
'tabs-item', 'NTabsItem'
|
|
57
|
+
]);
|
|
58
|
+
|
|
55
59
|
const tabs = this.ncx('tabs');
|
|
56
60
|
|
|
57
61
|
if ( this.data.scrollbar === null ) {
|
|
@@ -110,9 +114,19 @@ export class NTabsItemController extends ProtoController
|
|
|
110
114
|
return Arr.has(tabs.data.value, data.name);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
superOpen() : void
|
|
117
|
+
superOpen(cb : Function = null) : void
|
|
114
118
|
{
|
|
115
|
-
this.
|
|
119
|
+
const { name } = this.data;
|
|
120
|
+
|
|
121
|
+
const [tabs, parent] = [
|
|
122
|
+
this.ncx('tabs'), this.ncx('tabs-item')
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
const fn = () => {
|
|
126
|
+
tabs?.superToggle(name), cb && Run.frame(cb);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
parent ? parent.superOpen(fn) : fn();
|
|
116
130
|
}
|
|
117
131
|
|
|
118
132
|
}
|
|
@@ -20,26 +20,29 @@ export class NTabsItemView extends ProtoView
|
|
|
20
20
|
{
|
|
21
21
|
let { scope, data } = this.scope;
|
|
22
22
|
|
|
23
|
-
if ( !
|
|
23
|
+
if ( !scope.isActive() ) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
if ( !
|
|
27
|
+
if ( !data.init ) {
|
|
28
28
|
scope.set('init', true);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
let props : any = {
|
|
32
32
|
class: data.classList,
|
|
33
|
-
wrapClass: `${this.bem}__wrap`,
|
|
34
33
|
};
|
|
35
34
|
|
|
35
|
+
if ( data.scrollbar ) {
|
|
36
|
+
props.wrapClass = `${this.bem}__wrap`;
|
|
37
|
+
}
|
|
38
|
+
|
|
36
39
|
const tabs = scope.ncx('tabs');
|
|
37
40
|
|
|
38
41
|
if ( tabs.data.float ) {
|
|
39
42
|
props.class.push('n-float');
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
if ( !
|
|
45
|
+
if ( !scope.isVisible() ) {
|
|
43
46
|
props.style = 'display: none;';
|
|
44
47
|
}
|
|
45
48
|
|
|
@@ -47,7 +50,7 @@ export class NTabsItemView extends ProtoView
|
|
|
47
50
|
return this.slot('default');
|
|
48
51
|
};
|
|
49
52
|
|
|
50
|
-
if ( !
|
|
53
|
+
if ( !data.scrollbar ) {
|
|
51
54
|
return h('div', props, slot());
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -56,7 +59,7 @@ export class NTabsItemView extends ProtoView
|
|
|
56
59
|
]);
|
|
57
60
|
}
|
|
58
61
|
|
|
59
|
-
header(tabs: NTabsController) : any
|
|
62
|
+
header(tabs : NTabsController) : any
|
|
60
63
|
{
|
|
61
64
|
const { data } = this.scope
|
|
62
65
|
|
|
@@ -73,7 +76,7 @@ export class NTabsItemView extends ProtoView
|
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
props.onDragenter = () => {
|
|
76
|
-
if( tabs.data.dragOpen ) {
|
|
79
|
+
if ( tabs.data.dragOpen ) {
|
|
77
80
|
tabs.superToggle(data.name);
|
|
78
81
|
}
|
|
79
82
|
};
|
|
@@ -84,7 +87,7 @@ export class NTabsItemView extends ProtoView
|
|
|
84
87
|
]);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
header_icon(tabs: NTabsController) : any
|
|
90
|
+
header_icon(tabs : NTabsController) : any
|
|
88
91
|
{
|
|
89
92
|
const { data } = this.scope;
|
|
90
93
|
|
|
@@ -97,7 +100,7 @@ export class NTabsItemView extends ProtoView
|
|
|
97
100
|
]);
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
header_label(tabs: NTabsController) : any
|
|
103
|
+
header_label(tabs : NTabsController) : any
|
|
101
104
|
{
|
|
102
105
|
const { data } = this.scope;
|
|
103
106
|
|
|
@@ -31,7 +31,9 @@ export class NTransferController extends ProtoController
|
|
|
31
31
|
new NTransferData(this),
|
|
32
32
|
];
|
|
33
33
|
|
|
34
|
-
this.
|
|
34
|
+
if ( this.constructor.name === 'NTransferController' ) {
|
|
35
|
+
this.setup();
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
setup()
|
|
@@ -45,6 +47,7 @@ export class NTransferController extends ProtoController
|
|
|
45
47
|
.makeRef('target');
|
|
46
48
|
|
|
47
49
|
this.cloneProp('modelValue');
|
|
50
|
+
this.cloneProp('options');
|
|
48
51
|
|
|
49
52
|
this
|
|
50
53
|
.makeData('source')
|
|
@@ -52,12 +55,10 @@ export class NTransferController extends ProtoController
|
|
|
52
55
|
.makeData('target')
|
|
53
56
|
.makeData('targetSearch', '');
|
|
54
57
|
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
this.updateTarget();
|
|
58
|
-
});
|
|
58
|
+
this.updateSource();
|
|
59
|
+
this.updateTarget();
|
|
59
60
|
|
|
60
|
-
this.
|
|
61
|
+
this.watchData('modelValue', () => {
|
|
61
62
|
this.updateSource();
|
|
62
63
|
this.updateTarget();
|
|
63
64
|
});
|
|
@@ -70,12 +71,16 @@ export class NTransferController extends ProtoController
|
|
|
70
71
|
this.updateTarget();
|
|
71
72
|
});
|
|
72
73
|
|
|
73
|
-
this.updateSource();
|
|
74
|
-
this.updateTarget();
|
|
75
|
-
|
|
76
74
|
return this;
|
|
77
75
|
}
|
|
78
76
|
|
|
77
|
+
onMounted() {
|
|
78
|
+
this.watchData('options', () => {
|
|
79
|
+
this.updateSource();
|
|
80
|
+
this.updateTarget();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
updateSource()
|
|
80
85
|
{
|
|
81
86
|
const { data } = this.scope;
|
|
@@ -116,7 +121,6 @@ export class NTransferController extends ProtoController
|
|
|
116
121
|
|
|
117
122
|
moveToSource(item : any)
|
|
118
123
|
{
|
|
119
|
-
console.log(item);
|
|
120
124
|
const { uniqueProp } = this.data;
|
|
121
125
|
|
|
122
126
|
const result = Arr.clone(...[
|
|
@@ -117,7 +117,7 @@ export class NTransferView extends ProtoView
|
|
|
117
117
|
let slots : any = {};
|
|
118
118
|
|
|
119
119
|
slots.default = ({ item }) => {
|
|
120
|
-
return Obj.get(item,
|
|
120
|
+
return Obj.get(item, data.labelProp);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
const header = this.source_header();
|
|
@@ -187,7 +187,7 @@ export class NTransferView extends ProtoView
|
|
|
187
187
|
let slots : any = {};
|
|
188
188
|
|
|
189
189
|
slots.default = ({ item }) => {
|
|
190
|
-
return Obj.get(item,
|
|
190
|
+
return Obj.get(item, data.labelProp);
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
const header = this.target_header();
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@use "../../root/css/helpers" as *;
|
|
2
|
+
|
|
3
|
+
.n-message {
|
|
4
|
+
position: relative;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
border-radius: size('base-rad');
|
|
7
|
+
background: color('base-color', 0.3);
|
|
8
|
+
transition: max-height 0.2s;
|
|
9
|
+
max-height: var(--n-message-height);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.n-message__wrapper {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
justify-content: flex-start;
|
|
16
|
+
height: var(--n-message-height);
|
|
17
|
+
padding: 0 size('base-pad', 'calc($ * 0.5)') 0 size('base-pad');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
.n-message:not(.n-active) {
|
|
22
|
+
max-height: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.n-message:before {
|
|
26
|
+
content: '\00a0';
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
display: block;
|
|
31
|
+
width: 4px;
|
|
32
|
+
height: 100%;
|
|
33
|
+
background: color('base-color');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.n-message__symbol,
|
|
37
|
+
.n-message__close,
|
|
38
|
+
.n-message__body {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
min-height: size('base-hgt-inline', 'calc($ * 2.5)');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.n-message__body {
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
align-items: flex-start;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
padding: size('base-pad');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.n-message__symbol,
|
|
52
|
+
.n-message__close {
|
|
53
|
+
flex: 0 0 auto;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
padding: 0 size('base-pad', 'calc($ * 0.5)');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.n-message.with-title .n-message__symbol,
|
|
60
|
+
.n-message.with-title .n-message__close {
|
|
61
|
+
//padding: 0 size('base-pad', 'calc($ * 0.5)');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.n-message__symbol {
|
|
65
|
+
margin-left: 4px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.n-message__symbol .n-icon {
|
|
69
|
+
color: color('base-color-fg-20');
|
|
70
|
+
font-size: 1.2em;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.n-message__close {
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
flex: 0 0 auto;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.n-message__close a {
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
width: size('base-hgt-inline');
|
|
84
|
+
height: size('base-hgt-inline');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.n-message__close .n-icon {
|
|
88
|
+
color: color('base-color-fg-20');
|
|
89
|
+
font-size: size('base-fnt-icon');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.n-message__title {
|
|
93
|
+
font-size: 1.1em;
|
|
94
|
+
color: color('base-color-fg-20');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.n-message__text {
|
|
98
|
+
color: color('text', 0.75);
|
|
99
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use "../../root/css/helpers" as *;
|
|
2
|
+
|
|
3
|
+
@keyframes NProgress {
|
|
4
|
+
0% {
|
|
5
|
+
background-position: -200% 0;
|
|
6
|
+
}
|
|
7
|
+
50% {
|
|
8
|
+
background-position: 0 0;
|
|
9
|
+
}
|
|
10
|
+
100% {
|
|
11
|
+
background-position: 200% 0;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.n-progress {
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: size('base-hgt-inline');
|
|
20
|
+
background: color('gray-50', 0.15);
|
|
21
|
+
border-radius: size('base-rad');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.n-progress__bar {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: var(--n-progress-width, 0%);
|
|
29
|
+
height: 100%;
|
|
30
|
+
background-size: 200% 100%;
|
|
31
|
+
background-position: -200% 0;
|
|
32
|
+
background-repeat: no-repeat;
|
|
33
|
+
background-color: color('base-color-bg-10');
|
|
34
|
+
background-image: linear-gradient(90deg, color('base-color-bg-10') 0%, color('base-color-fg-20') 50%, color('base-color-bg-10') 100%);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.n-progress.n-active .n-progress__bar {
|
|
38
|
+
animation: NProgress 2s linear infinite;
|
|
39
|
+
}
|
package/src/visuals/index.scss
CHANGED
package/src/visuals/index.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { App } from "vue";
|
|
2
2
|
import NTag from "./js/tag/NTag.ts";
|
|
3
3
|
import NRating from "./js/rating/NRating.ts";
|
|
4
|
+
import NMessage from "./js/message/NMessage.ts";
|
|
5
|
+
import NProgress from "./js/progress/NProgress.ts";
|
|
4
6
|
|
|
5
7
|
export default function (App : App) {
|
|
6
8
|
App.component(NTag.name, NTag);
|
|
7
9
|
App.component(NRating.name, NRating);
|
|
10
|
+
App.component(NMessage.name, NMessage);
|
|
11
|
+
App.component(NProgress.name, NProgress);
|
|
8
12
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { PropType, defineComponent } from "vue";
|
|
2
|
+
import { Props } from "../../../root/index.ts";
|
|
3
|
+
import { NMessageController } from "./NMessageController.ts";
|
|
4
|
+
|
|
5
|
+
export const NMessageProps = {
|
|
6
|
+
|
|
7
|
+
...Props.Size,
|
|
8
|
+
...Props.Type,
|
|
9
|
+
...Props.Icon,
|
|
10
|
+
...Props.IconPositionBefore,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {PropType<boolean>}
|
|
14
|
+
*/
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: [Boolean], default: true
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {PropType<boolean>}
|
|
21
|
+
*/
|
|
22
|
+
closable: {
|
|
23
|
+
type: [Boolean], default: false
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @type {PropType<string>}
|
|
28
|
+
*/
|
|
29
|
+
title: {
|
|
30
|
+
type: [String], default: null
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default defineComponent({
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @type {string}
|
|
39
|
+
*/
|
|
40
|
+
name: 'NMessage',
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @type {typeof NMessageProps}
|
|
44
|
+
*/
|
|
45
|
+
props: NMessageProps,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @type {string[]}
|
|
49
|
+
*/
|
|
50
|
+
emits: [
|
|
51
|
+
//
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
setup(props, context)
|
|
55
|
+
{
|
|
56
|
+
let ncx = new NMessageController(props, context);
|
|
57
|
+
|
|
58
|
+
ncx.dispose(() => {
|
|
59
|
+
ncx = null;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return ncx.render();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { SetupContext } from "vue";
|
|
2
|
+
import { ProtoController } from "../../../root/index.ts";
|
|
3
|
+
import { NMessageView } from "./NMessageView.ts";
|
|
4
|
+
import { NMessageData } from "./NMessageData.ts";
|
|
5
|
+
import { Run } from "@kizmann/pico-js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class NMessageController extends ProtoController
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* @type {NMessageController}
|
|
12
|
+
*/
|
|
13
|
+
declare scope : NMessageController;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {NMessageData}
|
|
17
|
+
*/
|
|
18
|
+
declare data: NMessageData;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {NMessageView}
|
|
22
|
+
*/
|
|
23
|
+
declare view: NMessageView;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @type {ResizeObserver}
|
|
27
|
+
*/
|
|
28
|
+
observer : ResizeObserver;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
33
|
+
transition : boolean = false;
|
|
34
|
+
|
|
35
|
+
constructor(props:any, context:SetupContext)
|
|
36
|
+
{
|
|
37
|
+
super(props, context);
|
|
38
|
+
|
|
39
|
+
[this.view, this.data] = [
|
|
40
|
+
new NMessageView(this),
|
|
41
|
+
new NMessageData(this),
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
this.setup();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setup()
|
|
48
|
+
{
|
|
49
|
+
super.setup();
|
|
50
|
+
|
|
51
|
+
this.makeRef('el');
|
|
52
|
+
this.cloneProp('modelValue');
|
|
53
|
+
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onMounted()
|
|
58
|
+
{
|
|
59
|
+
this.dom('el').on('transitionrun', () => {
|
|
60
|
+
this.transition = true;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
this.dom('el').on('transitionend', () => {
|
|
64
|
+
Run.frame(() => this.transition = false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
this.observer = new ResizeObserver(() => {
|
|
68
|
+
this.applyMaxHeight();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
this.observer.observe(this.rel('el'))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onUnmounted()
|
|
75
|
+
{
|
|
76
|
+
this.observer.disconnect();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
applyMaxHeight() : void
|
|
80
|
+
{
|
|
81
|
+
const height = this.dom('el').actual((el : any) => {
|
|
82
|
+
return el.clientHeight;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if ( ! height || this.transition ) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.dom('el').style({
|
|
90
|
+
'--n-message-height': height + 'px',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default NMessageController;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ProtoData } from "../../../root/index.ts";
|
|
2
|
+
import NMessageController from "./NMessageController.ts";
|
|
3
|
+
|
|
4
|
+
export class NMessageData extends ProtoData
|
|
5
|
+
{
|
|
6
|
+
/**
|
|
7
|
+
* @type {NMessageController}
|
|
8
|
+
*/
|
|
9
|
+
declare scope : NMessageController;
|
|
10
|
+
|
|
11
|
+
get classList() : string[]
|
|
12
|
+
{
|
|
13
|
+
let classList = [];
|
|
14
|
+
|
|
15
|
+
if ( this.model ) {
|
|
16
|
+
classList.push('n-active');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if ( this.title ) {
|
|
20
|
+
classList.push('with-title');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return this.classRoot(classList);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get model() : boolean
|
|
27
|
+
{
|
|
28
|
+
return this.scope.get('modelValue');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get title() : string
|
|
32
|
+
{
|
|
33
|
+
return this.scope.get('title');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get closable() : boolean
|
|
37
|
+
{
|
|
38
|
+
return this.scope.get('closable');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default NMessageData;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import { ProtoView, Styler } from "../../../root/index.ts";
|
|
3
|
+
import { NMessageController } from "./NMessageController.ts";
|
|
4
|
+
|
|
5
|
+
export class NMessageView extends ProtoView
|
|
6
|
+
{
|
|
7
|
+
/**
|
|
8
|
+
* @type {NMessageController}
|
|
9
|
+
*/
|
|
10
|
+
declare scope : NMessageController;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
bem : string = 'n-message';
|
|
16
|
+
|
|
17
|
+
default() : any
|
|
18
|
+
{
|
|
19
|
+
let { scope, data } = this.scope;
|
|
20
|
+
|
|
21
|
+
let props : any = {
|
|
22
|
+
ref: scope.ref('el'),
|
|
23
|
+
class: data.classList,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return h('div', props, [
|
|
27
|
+
this.wrapper()
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
wrapper() : any
|
|
32
|
+
{
|
|
33
|
+
return this.div('wrapper', [
|
|
34
|
+
this.symbol(), this.body(), this.close()
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
symbol() : any
|
|
39
|
+
{
|
|
40
|
+
let { scope, data } = this.scope;
|
|
41
|
+
|
|
42
|
+
if ( ! data.icon ) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return this.div('symbol', [
|
|
47
|
+
this.icon(data.icon)
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
body() : any
|
|
52
|
+
{
|
|
53
|
+
return this.div('body', [
|
|
54
|
+
this.title(), this.text()
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
title() : any
|
|
59
|
+
{
|
|
60
|
+
let { scope, data } = this.scope;
|
|
61
|
+
|
|
62
|
+
if ( ! data.title ) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return this.div('title', [
|
|
67
|
+
h('span', null, [data.title])
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
text() : any
|
|
72
|
+
{
|
|
73
|
+
return this.div('text', [
|
|
74
|
+
this.slot('default')
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
close() : any
|
|
79
|
+
{
|
|
80
|
+
const { scope, data } = this.scope;
|
|
81
|
+
|
|
82
|
+
if ( ! data.closable ) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let props : any = {
|
|
87
|
+
href: 'javascript:void(0);'
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
props.onPointerdown = (e : any) => {
|
|
91
|
+
scope.update('modelValue', false);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return this.div('close', [
|
|
95
|
+
h('a', props, [this.icon(Styler.icon('times'))])
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default NMessageView;
|