@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
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { h, withMemo } from "vue";
|
|
2
2
|
import { ProtoView } from "../../../root/index.ts";
|
|
3
3
|
import { NVirtualbarController } from "./NVirtualbarController.ts";
|
|
4
|
-
import { Arr } from "@kizmann/pico-js";
|
|
5
|
-
|
|
6
|
-
const VirtualRow = () => {
|
|
7
|
-
|
|
8
|
-
};
|
|
4
|
+
import { Arr, Mix } from "@kizmann/pico-js";
|
|
9
5
|
|
|
10
6
|
export class NVirtualbarView extends ProtoView
|
|
11
7
|
{
|
|
@@ -73,7 +69,7 @@ export class NVirtualbarView extends ProtoView
|
|
|
73
69
|
};
|
|
74
70
|
|
|
75
71
|
return h('div', props, [
|
|
76
|
-
this.wrapper()
|
|
72
|
+
data.items.length ? this.wrapper() : this.empty()
|
|
77
73
|
]);
|
|
78
74
|
}
|
|
79
75
|
|
|
@@ -114,12 +110,20 @@ export class NVirtualbarView extends ProtoView
|
|
|
114
110
|
|
|
115
111
|
grid()
|
|
116
112
|
{
|
|
117
|
-
const [
|
|
118
|
-
this.scope, this.scope.data.state
|
|
113
|
+
const [data, state] = [
|
|
114
|
+
this.scope.data, this.scope.data.state
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
if ( state.total == null ) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const [start, end] = [
|
|
122
|
+
Math.max(1, state.start), Math.min(state.end, state.total - 1)
|
|
119
123
|
];
|
|
120
124
|
|
|
121
125
|
const rows = Arr.chunk(...[
|
|
122
|
-
data.items, grid
|
|
126
|
+
data.items, state.grid
|
|
123
127
|
]);
|
|
124
128
|
|
|
125
129
|
let items = Arr.slice(...[
|
|
@@ -130,12 +134,24 @@ export class NVirtualbarView extends ProtoView
|
|
|
130
134
|
return this.row(value, index + start);
|
|
131
135
|
});
|
|
132
136
|
|
|
133
|
-
|
|
137
|
+
const first = this.row(...[
|
|
138
|
+
rows[0], 0
|
|
139
|
+
]);
|
|
140
|
+
|
|
141
|
+
const last = this.row(...[
|
|
142
|
+
rows[state.total - 1], state.total - 1
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
return [first, ...result, state.total > 1 && last];
|
|
134
146
|
}
|
|
135
147
|
|
|
136
148
|
row(row : any[], index : number) : any
|
|
137
149
|
{
|
|
138
|
-
const { context, data } = this.scope;
|
|
150
|
+
const { scope, context, data } = this.scope;
|
|
151
|
+
|
|
152
|
+
if ( Mix.isEmpty(row) ) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
139
155
|
|
|
140
156
|
let fn = () => null;
|
|
141
157
|
|
|
@@ -144,7 +160,7 @@ export class NVirtualbarView extends ProtoView
|
|
|
144
160
|
}
|
|
145
161
|
|
|
146
162
|
let props : any = {
|
|
147
|
-
class: [`${this.vem}__row`]
|
|
163
|
+
key: scope.uid + index, class: [`${this.vem}__row`]
|
|
148
164
|
};
|
|
149
165
|
|
|
150
166
|
props.style = {
|
|
@@ -162,11 +178,16 @@ export class NVirtualbarView extends ProtoView
|
|
|
162
178
|
|
|
163
179
|
list()
|
|
164
180
|
{
|
|
165
|
-
const
|
|
181
|
+
const [data, state] = [
|
|
182
|
+
this.scope.data, this.scope.data.state
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
if ( state.total == null ) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
166
188
|
|
|
167
189
|
const [start, end] = [
|
|
168
|
-
Math.max(1,
|
|
169
|
-
Math.min(data.state.end, data.items.length - 1)
|
|
190
|
+
Math.max(1, state.start), Math.min(state.end, state.total - 1)
|
|
170
191
|
];
|
|
171
192
|
|
|
172
193
|
let items = Arr.slice(...[
|
|
@@ -175,63 +196,44 @@ export class NVirtualbarView extends ProtoView
|
|
|
175
196
|
|
|
176
197
|
let fn = () => null;
|
|
177
198
|
|
|
178
|
-
if ( context.slots.default ) {
|
|
179
|
-
fn = context.slots.default;
|
|
199
|
+
if ( this.scope.context.slots.default ) {
|
|
200
|
+
fn = this.scope.context.slots.default;
|
|
180
201
|
}
|
|
181
202
|
|
|
182
203
|
const result = Arr.each(items, (value : any, index : number) => {
|
|
183
204
|
return this.node({ value, index: index + start }, fn);
|
|
184
205
|
});
|
|
185
206
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
first() : any
|
|
192
|
-
{
|
|
193
|
-
const { context, data } = this.scope;
|
|
194
|
-
|
|
195
|
-
let fn = () => null;
|
|
196
|
-
|
|
197
|
-
if ( context.slots.default ) {
|
|
198
|
-
fn = context.slots.default;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return this.node({
|
|
202
|
-
value: Arr.first(data.items), index: 0
|
|
203
|
-
}, fn);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
last() : any
|
|
207
|
-
{
|
|
208
|
-
const { context, data } = this.scope;
|
|
209
|
-
|
|
210
|
-
let fn = () => null;
|
|
207
|
+
const first = this.node(...[
|
|
208
|
+
{ value: data.items[0], index: 0 }, fn
|
|
209
|
+
]);
|
|
211
210
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
const last = this.node(...[
|
|
212
|
+
{ value: data.items[state.total - 1], index: state.total - 1 }, fn
|
|
213
|
+
]);
|
|
215
214
|
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
return [
|
|
216
|
+
first, ...result, state.total > 1 && last
|
|
217
|
+
];
|
|
219
218
|
}
|
|
220
219
|
|
|
221
220
|
node(item : any, fn : Function, row : boolean = false)
|
|
222
221
|
{
|
|
223
222
|
const { data } = this.scope;
|
|
224
223
|
|
|
224
|
+
if ( Mix.isEmpty(item.value) ) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
225
228
|
let props : any = {
|
|
226
229
|
key: this.scope.uid + item.index,
|
|
227
230
|
class: [`${this.vem}__item`],
|
|
228
|
-
style: {}
|
|
229
231
|
};
|
|
230
232
|
|
|
231
233
|
const height = data.itemHeight;
|
|
232
234
|
|
|
233
|
-
if ( !
|
|
234
|
-
props.style
|
|
235
|
+
if ( !row ) {
|
|
236
|
+
props.style = { top: `${item.index * height}px` };
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
return h('div', props, [fn(item)]);
|
|
@@ -20,10 +20,12 @@ export class NAlertElement
|
|
|
20
20
|
*/
|
|
21
21
|
options : any = {
|
|
22
22
|
uid: null,
|
|
23
|
+
icon: null,
|
|
23
24
|
text: null,
|
|
24
25
|
theme: 'dark',
|
|
25
26
|
size: null,
|
|
26
27
|
type: null,
|
|
28
|
+
closable: true,
|
|
27
29
|
okayText: null,
|
|
28
30
|
};
|
|
29
31
|
|
|
@@ -55,7 +57,7 @@ export class NAlertElement
|
|
|
55
57
|
open()
|
|
56
58
|
{
|
|
57
59
|
let modalProps : any = {
|
|
58
|
-
uid: this.options.uid, listen: false, closable:
|
|
60
|
+
uid: this.options.uid, listen: false, closable: this.options.closable,
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
this.modal = NModalHandler.append(...[
|
|
@@ -107,7 +109,7 @@ export class NAlertElement
|
|
|
107
109
|
|
|
108
110
|
body.appendTo(frame);
|
|
109
111
|
|
|
110
|
-
const iconCls = Styler.icon(...[
|
|
112
|
+
const iconCls = this.options.icon || Styler.icon(...[
|
|
111
113
|
this.options.type, 'alert'
|
|
112
114
|
]);
|
|
113
115
|
|
|
@@ -170,8 +170,8 @@ export class NConfirmElement
|
|
|
170
170
|
class: cancelCls.join(' '),
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
-
cancel.on('
|
|
174
|
-
this.signal(false);
|
|
173
|
+
cancel.on('pointerdown', (e : any) => {
|
|
174
|
+
if ( e.which === 1 ) this.signal(false);
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
cancel.html(...[
|
|
@@ -188,8 +188,8 @@ export class NConfirmElement
|
|
|
188
188
|
class: confirmCls.join(' '),
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
-
confirm.on('
|
|
192
|
-
this.signal(true);
|
|
191
|
+
confirm.on('pointerdown', (e : any) => {
|
|
192
|
+
if ( e.which === 1 ) this.signal(true);
|
|
193
193
|
});
|
|
194
194
|
|
|
195
195
|
confirm.html(...[
|
|
@@ -21,7 +21,7 @@ export class NSwitchController extends ProtoController
|
|
|
21
21
|
*/
|
|
22
22
|
declare view : NSwitchView;
|
|
23
23
|
|
|
24
|
-
constructor(props:any, context:SetupContext)
|
|
24
|
+
constructor(props : any, context : SetupContext)
|
|
25
25
|
{
|
|
26
26
|
super(props, context);
|
|
27
27
|
|
|
@@ -37,12 +37,28 @@ export class NSwitchController extends ProtoController
|
|
|
37
37
|
{
|
|
38
38
|
super.setup();
|
|
39
39
|
|
|
40
|
-
this
|
|
41
|
-
|
|
40
|
+
this.cloneProp('modelValue');
|
|
41
|
+
|
|
42
|
+
this.resetValue();
|
|
42
43
|
|
|
43
44
|
return this;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
resetValue()
|
|
48
|
+
{
|
|
49
|
+
const { data } = this;
|
|
50
|
+
|
|
51
|
+
if ( data.model === data.onValue ) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if ( data.model === data.offValue ) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.set('modelValue', data.offValue);
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
toggle()
|
|
47
63
|
{
|
|
48
64
|
let value = this.data.model;
|
|
@@ -59,7 +75,7 @@ export class NSwitchController extends ProtoController
|
|
|
59
75
|
this.data.onValue, this.data.offValue
|
|
60
76
|
];
|
|
61
77
|
|
|
62
|
-
if ( !
|
|
78
|
+
if ( !Arr.has(both, value) ) {
|
|
63
79
|
value = this.data.onValue;
|
|
64
80
|
}
|
|
65
81
|
|
package/src/table/css/table.scss
CHANGED
|
@@ -75,12 +75,6 @@
|
|
|
75
75
|
width: 32px;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.n-table__checkbox .n-checkbox__label {
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
white-space: nowrap;
|
|
81
|
-
text-overflow: ellipsis;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
78
|
.n-table__body {
|
|
85
79
|
overflow: hidden;
|
|
86
80
|
flex: 1 1 auto;
|
|
@@ -118,4 +112,43 @@
|
|
|
118
112
|
align-items: stretch;
|
|
119
113
|
justify-content: flex-start;
|
|
120
114
|
border-bottom: 1px solid transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.n-table-context .n-popover__frame {
|
|
118
|
+
width: 160px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.n-table-context .n-popover__body {
|
|
122
|
+
max-height: calc(100vh - 60px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.n-table-context .n-checkbox__label {
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.n-table-filter .n-form-item {
|
|
132
|
+
margin-bottom: size('base-pad-vertical');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.n-table-filter .n-popover__frame {
|
|
136
|
+
width: 210px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.n-table-filter .n-popover__body {
|
|
140
|
+
max-height: calc(100vh - 60px);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.n-table-filter .n-popover__footer {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: row;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.n-table-filter .n-popover__footer > *:first-child {
|
|
149
|
+
margin-right: auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.n-table-filter .n-popover__footer > *:last-child {
|
|
153
|
+
margin-left: auto;
|
|
121
154
|
}
|
|
@@ -65,13 +65,16 @@ export default defineComponent({
|
|
|
65
65
|
'update:current',
|
|
66
66
|
'update:selected',
|
|
67
67
|
'update:expanded',
|
|
68
|
+
'update:cascade',
|
|
68
69
|
'update:filter',
|
|
69
70
|
'update:sortProp',
|
|
70
71
|
'update:sortDir',
|
|
71
72
|
'filter',
|
|
72
73
|
'sort',
|
|
73
74
|
'row-click',
|
|
75
|
+
'node-click',
|
|
74
76
|
'row-dblclick',
|
|
77
|
+
'node-dblclick',
|
|
75
78
|
],
|
|
76
79
|
|
|
77
80
|
setup(props, context)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { onMounted, provide, SetupContext } from "vue";
|
|
2
|
-
import { Arr, Mix } from "@kizmann/pico-js";
|
|
2
|
+
import { Arr, Mix, Obj } from "@kizmann/pico-js";
|
|
3
3
|
import { GroupController } from "../../../root/index.ts";
|
|
4
4
|
import { NTableView } from "./NTableView.ts";
|
|
5
5
|
import { NTableData } from "./NTableData.ts";
|
|
@@ -38,6 +38,8 @@ export class NTableController extends GroupController
|
|
|
38
38
|
{
|
|
39
39
|
super.setup();
|
|
40
40
|
|
|
41
|
+
this.makeUID();
|
|
42
|
+
|
|
41
43
|
this
|
|
42
44
|
.cloneProp('visible')
|
|
43
45
|
.cloneProp('filter')
|
|
@@ -88,7 +90,7 @@ export class NTableController extends GroupController
|
|
|
88
90
|
});
|
|
89
91
|
|
|
90
92
|
const visible = Arr.each(columns, (column : any) => {
|
|
91
|
-
return column.
|
|
93
|
+
return column.data.prop;
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
this.update('visible', visible);
|
|
@@ -113,13 +115,13 @@ export class NTableController extends GroupController
|
|
|
113
115
|
value: null, type: data.type, property: data.filterProp,
|
|
114
116
|
};
|
|
115
117
|
|
|
116
|
-
const active = Arr.find({
|
|
118
|
+
const active = Arr.find(this.data.filter, {
|
|
117
119
|
// @ts-ignore
|
|
118
120
|
property: value.property
|
|
119
121
|
});
|
|
120
122
|
|
|
121
123
|
if ( merge && active ) {
|
|
122
|
-
value =
|
|
124
|
+
value = Obj.assign(value, Obj.clone(active));
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
return value;
|
|
@@ -75,10 +75,11 @@ export class NTableView extends ProtoView
|
|
|
75
75
|
const { scope, data } = this.scope;
|
|
76
76
|
|
|
77
77
|
let contextProps = {
|
|
78
|
+
class: `${this.bem}-context`,
|
|
78
79
|
size: 'sm',
|
|
79
80
|
trigger: 'context',
|
|
80
81
|
toggle: true,
|
|
81
|
-
|
|
82
|
+
scrollbar: true,
|
|
82
83
|
};
|
|
83
84
|
|
|
84
85
|
const group = this.comp('n-popover-group', null, () => {
|
|
@@ -95,14 +96,14 @@ export class NTableView extends ProtoView
|
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
const values = Arr.each(scope.childs, (column : any) => {
|
|
98
|
-
return this.comp('n-checkbox', { value: column.
|
|
99
|
+
return this.comp('n-checkbox', { value: column.data.prop }, () => {
|
|
99
100
|
return column.data.label;
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
const checkbox = this.comp('n-checkbox-group', groupProps, () => {
|
|
104
105
|
return values;
|
|
105
|
-
})
|
|
106
|
+
});
|
|
106
107
|
|
|
107
108
|
return this.comp('n-popover', contextProps, () => [
|
|
108
109
|
group, checkbox
|
|
@@ -113,12 +114,18 @@ export class NTableView extends ProtoView
|
|
|
113
114
|
{
|
|
114
115
|
const { scope, data } = this.scope;
|
|
115
116
|
|
|
116
|
-
if ( !Arr.has(data.visible, column.
|
|
117
|
+
if ( !Arr.has(data.visible, column.data.prop) ) {
|
|
117
118
|
return null;
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
const classList = [
|
|
122
|
+
`${this.bem}-column`,
|
|
123
|
+
`${this.bem}-column--${column.data.type}`,
|
|
124
|
+
`${this.bem}-column--${column.data.align}`,
|
|
125
|
+
]
|
|
126
|
+
|
|
120
127
|
let props : any = {
|
|
121
|
-
class:
|
|
128
|
+
class: classList,
|
|
122
129
|
};
|
|
123
130
|
|
|
124
131
|
const sorted = [
|
|
@@ -141,12 +148,16 @@ export class NTableView extends ProtoView
|
|
|
141
148
|
'z-index': scope.childs.length - index
|
|
142
149
|
};
|
|
143
150
|
|
|
151
|
+
if ( column.data.tooltip ) {
|
|
152
|
+
props['data-tooltip-inv'] = column.data.tooltip;
|
|
153
|
+
}
|
|
154
|
+
|
|
144
155
|
if ( column.data.fixedWidth ) {
|
|
145
156
|
props.disabled = true;
|
|
146
157
|
}
|
|
147
158
|
|
|
148
159
|
props = {
|
|
149
|
-
...props, ...scope.getStyle(column),
|
|
160
|
+
group: [scope.uid], ...props, ...scope.getStyle(column),
|
|
150
161
|
};
|
|
151
162
|
|
|
152
163
|
if ( !Mix.isEmpty(data.fixedWidth) ) {
|
|
@@ -210,7 +221,7 @@ export class NTableView extends ProtoView
|
|
|
210
221
|
class: [`${this.bem}-column__filter`],
|
|
211
222
|
};
|
|
212
223
|
|
|
213
|
-
angleProps.onClick = (e) => {
|
|
224
|
+
angleProps.onClick = (e : any) => {
|
|
214
225
|
e.stopPropagation();
|
|
215
226
|
};
|
|
216
227
|
|
|
@@ -265,8 +276,9 @@ export class NTableView extends ProtoView
|
|
|
265
276
|
]);
|
|
266
277
|
|
|
267
278
|
const props = {
|
|
279
|
+
class: `${this.bem}-filter`,
|
|
268
280
|
toggle: true,
|
|
269
|
-
|
|
281
|
+
scrollbar: true,
|
|
270
282
|
};
|
|
271
283
|
|
|
272
284
|
const component = this.resolve(...[
|
|
@@ -278,7 +290,7 @@ export class NTableView extends ProtoView
|
|
|
278
290
|
};
|
|
279
291
|
|
|
280
292
|
let slots = {
|
|
281
|
-
default: () =>
|
|
293
|
+
default: () => component(compProps),
|
|
282
294
|
footer: () => [reset, apply]
|
|
283
295
|
};
|
|
284
296
|
|
|
@@ -289,7 +301,7 @@ export class NTableView extends ProtoView
|
|
|
289
301
|
{
|
|
290
302
|
let { scope, data } = this.scope;
|
|
291
303
|
|
|
292
|
-
let props = {
|
|
304
|
+
let props : any = {
|
|
293
305
|
ref: scope.ref('draglist'),
|
|
294
306
|
items: data.items,
|
|
295
307
|
overflowX: false,
|
|
@@ -297,17 +309,49 @@ export class NTableView extends ProtoView
|
|
|
297
309
|
};
|
|
298
310
|
|
|
299
311
|
const passed = [
|
|
300
|
-
'
|
|
301
|
-
'
|
|
312
|
+
'group',
|
|
313
|
+
'expanded',
|
|
314
|
+
'cascade',
|
|
315
|
+
'allowGroup',
|
|
316
|
+
'safezone',
|
|
302
317
|
'renderHandle',
|
|
303
318
|
'renderExpand',
|
|
304
319
|
'renderSelect',
|
|
320
|
+
'allowDrop',
|
|
321
|
+
'allowDrag',
|
|
322
|
+
'allowSelect',
|
|
323
|
+
'allowCurrent',
|
|
324
|
+
'transformDrop',
|
|
325
|
+
'insertNode',
|
|
326
|
+
'removeNode',
|
|
327
|
+
'itemSkip',
|
|
328
|
+
'rootSkip',
|
|
329
|
+
'uniqueProp',
|
|
330
|
+
'childProp',
|
|
331
|
+
'itemHeight',
|
|
332
|
+
'itemOffset',
|
|
305
333
|
];
|
|
306
334
|
|
|
307
335
|
Arr.each(passed, (key : any) => {
|
|
308
336
|
props[key] = scope.props[key];
|
|
309
337
|
});
|
|
310
338
|
|
|
339
|
+
props.onRowClick = (node : any) => {
|
|
340
|
+
this.scope.emit('row-click', node);
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
props.onRowDblclick = (node : any) => {
|
|
344
|
+
this.scope.emit('row-dblclick', node);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
props.onNodeClick = (node : any) => {
|
|
348
|
+
this.scope.emit('node-click', node);
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
props.onNodeDblclick = (node : any) => {
|
|
352
|
+
this.scope.emit('node-dblclick', node);
|
|
353
|
+
};
|
|
354
|
+
|
|
311
355
|
props['onUpdate:items'] = (value : any) => {
|
|
312
356
|
scope.emit('update:items', value);
|
|
313
357
|
};
|
|
@@ -324,6 +368,10 @@ export class NTableView extends ProtoView
|
|
|
324
368
|
scope.emit('update:expanded', value);
|
|
325
369
|
};
|
|
326
370
|
|
|
371
|
+
props['onUpdate:cascade'] = (value : any) => {
|
|
372
|
+
scope.emit('update:cascade', value);
|
|
373
|
+
};
|
|
374
|
+
|
|
327
375
|
return this.comp('n-draglist', props, (node : any) => {
|
|
328
376
|
return this.rows(node)
|
|
329
377
|
});
|
|
@@ -334,7 +382,7 @@ export class NTableView extends ProtoView
|
|
|
334
382
|
const { scope, data } = this.scope;
|
|
335
383
|
|
|
336
384
|
const columns = Arr.filter(scope.childs, (column : any) => {
|
|
337
|
-
return Arr.has(data.visible, column.
|
|
385
|
+
return Arr.has(data.visible, column.data.prop);
|
|
338
386
|
});
|
|
339
387
|
|
|
340
388
|
return Arr.each(columns, (column : any, index : number) => {
|
|
@@ -359,7 +407,7 @@ export class NTableView extends ProtoView
|
|
|
359
407
|
];
|
|
360
408
|
|
|
361
409
|
let props : any = {
|
|
362
|
-
class: classList
|
|
410
|
+
key: column.uid, class: classList
|
|
363
411
|
};
|
|
364
412
|
|
|
365
413
|
let width = this.scope.getWidth(column.uid);
|
|
@@ -19,7 +19,7 @@ export const NTableCellImage = ({ node, table, column, props, input, comp }) =>
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if ( Obj.has(data, 'thumbProp') ) {
|
|
22
|
-
image.thumb = Obj.get(node
|
|
22
|
+
image.thumb = Obj.get(node?.item, data.thumbProp);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
image.onFocus = () => {
|
|
@@ -43,6 +43,11 @@ export class NTableColumnData extends ProtoExtend([ProtoData, OptionData, TextDa
|
|
|
43
43
|
return this.scope.get('label');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
get tooltip():string
|
|
47
|
+
{
|
|
48
|
+
return this.scope.get('tooltip');
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
get prop():string
|
|
47
52
|
{
|
|
48
53
|
return this.scope.get('prop');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
2
|
import { Arr, Locale, Mix, Obj } from "@kizmann/pico-js";
|
|
3
3
|
|
|
4
|
-
export const NTableFilterOption = ({ model, comp, column, table }) => {
|
|
4
|
+
export const NTableFilterOption = ({ model, comp, column, table, options }) => {
|
|
5
5
|
|
|
6
6
|
if ( !Mix.isArr(model.value) ) {
|
|
7
7
|
Obj.set(model, 'value', []);
|
|
@@ -20,11 +20,11 @@ export const NTableFilterOption = ({ model, comp, column, table }) => {
|
|
|
20
20
|
Obj.set(model, 'value', value);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const values = Arr.each(column.getOptions(), ({ label, value }) => {
|
|
23
|
+
const values = Arr.each(options ?? column.getOptions(), ({ label, value }) => {
|
|
24
24
|
return comp('n-checkbox', { value }, () => label);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const value = comp('n-form-item',
|
|
27
|
+
const value = comp('n-form-item', null, () => [
|
|
28
28
|
comp('n-checkbox-group', valueProps, () => values),
|
|
29
29
|
]);
|
|
30
30
|
|
|
@@ -41,13 +41,11 @@ export const NTableFilterOption = ({ model, comp, column, table }) => {
|
|
|
41
41
|
'ni': Locale.trans('Excludes value'),
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
const operator = comp('n-form-item',
|
|
44
|
+
const operator = comp('n-form-item', null, () => [
|
|
45
45
|
comp('n-select', operatorProps)
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
|
-
return
|
|
49
|
-
value, operator
|
|
50
|
-
]);
|
|
48
|
+
return [value, operator];
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
export default NTableFilterOption;
|