ezfw-core 1.0.0
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/EzBaseComponent.ts +648 -0
- package/components/EzComponent.ts +89 -0
- package/components/EzInput.module.scss +183 -0
- package/components/EzInput.ts +104 -0
- package/components/EzLabel.ts +22 -0
- package/components/EzOutlet.ts +181 -0
- package/components/HtmlWrapper.ts +305 -0
- package/components/avatar/EzAvatar.module.scss +200 -0
- package/components/avatar/EzAvatar.ts +130 -0
- package/components/badge/EzBadge.module.scss +202 -0
- package/components/badge/EzBadge.ts +77 -0
- package/components/button/EzButton.module.scss +402 -0
- package/components/button/EzButton.ts +175 -0
- package/components/button/EzButtonGroup.ts +48 -0
- package/components/card/EzCard.module.scss +71 -0
- package/components/card/EzCard.ts +120 -0
- package/components/chart/EzBarChart.ts +47 -0
- package/components/chart/EzChart.module.scss +14 -0
- package/components/chart/EzChart.ts +279 -0
- package/components/chart/EzDoughnutChart.ts +47 -0
- package/components/chart/EzLineChart.ts +53 -0
- package/components/checkbox/EzCheckbox.module.scss +145 -0
- package/components/checkbox/EzCheckbox.ts +115 -0
- package/components/dataview/EzDataView.module.scss +115 -0
- package/components/dataview/EzDataView.ts +355 -0
- package/components/dataview/modes/EzDataViewCards.ts +322 -0
- package/components/dataview/modes/EzDataViewGrid.ts +76 -0
- package/components/datepicker/EzDatePicker.module.scss +348 -0
- package/components/datepicker/EzDatePicker.ts +519 -0
- package/components/dialog/EzDialog.module.scss +180 -0
- package/components/dropdown/EzDropdown.module.scss +107 -0
- package/components/dropdown/EzDropdown.ts +235 -0
- package/components/feed/EzActivityFeed.module.scss +90 -0
- package/components/feed/EzActivityFeed.ts +78 -0
- package/components/form/EzForm.ts +364 -0
- package/components/form/EzValidators.test.js +421 -0
- package/components/form/EzValidators.ts +202 -0
- package/components/grid/EzGrid.scss +88 -0
- package/components/grid/EzGrid.ts +1085 -0
- package/components/grid/EzGridContainer.ts +104 -0
- package/components/grid/body/EzGridBody.scss +283 -0
- package/components/grid/body/EzGridBody.ts +549 -0
- package/components/grid/body/EzGridCell.ts +211 -0
- package/components/grid/body/EzGridRow.ts +196 -0
- package/components/grid/filter/EzGridFilters.scss +78 -0
- package/components/grid/filter/EzGridFilters.ts +285 -0
- package/components/grid/footer/EzGridFooter.scss +136 -0
- package/components/grid/footer/EzGridFooter.ts +448 -0
- package/components/grid/header/EzGridHeader.scss +199 -0
- package/components/grid/header/EzGridHeader.ts +430 -0
- package/components/grid/query/EzGridQuery.ts +81 -0
- package/components/grid/state/EzGridColumns.ts +155 -0
- package/components/grid/state/EzGridController.ts +470 -0
- package/components/grid/state/EzGridLifecycle.ts +136 -0
- package/components/grid/state/EzGridNormalizers.test.js +273 -0
- package/components/grid/state/EzGridNormalizers.ts +162 -0
- package/components/grid/state/EzGridParts.ts +233 -0
- package/components/grid/state/EzGridPersistence.ts +140 -0
- package/components/grid/state/EzGridRemote.test.js +573 -0
- package/components/grid/state/EzGridRemote.ts +335 -0
- package/components/grid/state/EzGridSelection.ts +231 -0
- package/components/grid/state/EzGridSort.ts +286 -0
- package/components/grid/title/EzGridActionBar.ts +98 -0
- package/components/grid/title/EzGridTitle.ts +114 -0
- package/components/grid/title/EzGridTitleBar.scss +65 -0
- package/components/grid/title/EzGridTitleBar.ts +87 -0
- package/components/grid/types.ts +607 -0
- package/components/panel/EzPanel.module.scss +133 -0
- package/components/panel/EzPanel.ts +147 -0
- package/components/radio/EzRadio.module.scss +190 -0
- package/components/radio/EzRadio.ts +149 -0
- package/components/select/EzSelect.module.scss +153 -0
- package/components/select/EzSelect.ts +238 -0
- package/components/skeleton/EzSkeleton.module.scss +95 -0
- package/components/skeleton/EzSkeleton.ts +70 -0
- package/components/store/EzStore.ts +344 -0
- package/components/switch/EzSwitch.module.scss +164 -0
- package/components/switch/EzSwitch.ts +117 -0
- package/components/tabs/EzTabPanel.module.scss +181 -0
- package/components/tabs/EzTabPanel.ts +402 -0
- package/components/textarea/EzTextarea.module.scss +131 -0
- package/components/textarea/EzTextarea.ts +161 -0
- package/components/timepicker/EzTimePicker.module.scss +282 -0
- package/components/timepicker/EzTimePicker.ts +540 -0
- package/components/toast/EzToast.module.scss +291 -0
- package/components/tooltip/EzTooltip.module.scss +124 -0
- package/components/tooltip/EzTooltip.ts +153 -0
- package/core/EzComponentTypes.ts +693 -0
- package/core/EzError.ts +63 -0
- package/core/EzModel.ts +268 -0
- package/core/EzTypes.ts +328 -0
- package/core/eventBus.ts +284 -0
- package/core/ez.ts +617 -0
- package/core/loader.ts +725 -0
- package/core/renderer.ts +1010 -0
- package/core/router.ts +490 -0
- package/core/services.ts +124 -0
- package/core/state.ts +142 -0
- package/core/utils.ts +81 -0
- package/package.json +51 -0
- package/services/RouteUI.js +17 -0
- package/services/crypto.js +64 -0
- package/services/dialog.js +222 -0
- package/services/fetchApi.js +63 -0
- package/services/firebase.js +30 -0
- package/services/toast.js +214 -0
- package/template/doc/EzDocs.js +15 -0
- package/template/doc/EzDocs.module.scss +627 -0
- package/template/doc/EzDocsController.js +164 -0
- package/template/doc/data/activityfeed/EzActivityFeedDoc.js +42 -0
- package/template/doc/data/avatar/EzAvatarDoc.js +71 -0
- package/template/doc/data/badge/EzBadgeDoc.js +92 -0
- package/template/doc/data/button/EzButtonDoc.js +77 -0
- package/template/doc/data/buttongroup/EzButtonGroupDoc.js +102 -0
- package/template/doc/data/card/EzCardDoc.js +39 -0
- package/template/doc/data/chart/EzChartDoc.js +60 -0
- package/template/doc/data/checkbox/EzCheckboxDoc.js +67 -0
- package/template/doc/data/component/EzComponentDoc.js +34 -0
- package/template/doc/data/cssmodules/CSSModulesDoc.js +70 -0
- package/template/doc/data/datepicker/EzDatePickerDoc.js +126 -0
- package/template/doc/data/dialog/EzDialogDoc.js +217 -0
- package/template/doc/data/dropdown/EzDropdownDoc.js +178 -0
- package/template/doc/data/form/EzFormDoc.js +90 -0
- package/template/doc/data/grid/EzGridDoc.js +99 -0
- package/template/doc/data/input/EzInputDoc.js +92 -0
- package/template/doc/data/label/EzLabelDoc.js +40 -0
- package/template/doc/data/model/EzModelDoc.js +53 -0
- package/template/doc/data/outlet/EzOutletDoc.js +63 -0
- package/template/doc/data/panel/EzPanelDoc.js +214 -0
- package/template/doc/data/radio/EzRadioDoc.js +174 -0
- package/template/doc/data/router/EzRouterDoc.js +75 -0
- package/template/doc/data/select/EzSelectDoc.js +37 -0
- package/template/doc/data/skeleton/EzSkeletonDoc.js +149 -0
- package/template/doc/data/switch/EzSwitchDoc.js +82 -0
- package/template/doc/data/tabpanel/EzTabPanelDoc.js +44 -0
- package/template/doc/data/textarea/EzTextareaDoc.js +131 -0
- package/template/doc/data/timepicker/EzTimePickerDoc.js +107 -0
- package/template/doc/data/tooltip/EzTooltipDoc.js +193 -0
- package/template/doc/data/validators/EzValidatorsDoc.js +37 -0
- package/template/doc/sidebar/EzDocsSidebar.js +32 -0
- package/template/doc/sidebar/category/EzDocsCategory.js +33 -0
- package/template/doc/sidebar/item/EzDocsComponentItem.js +24 -0
- package/template/doc/viewer/EzDocsViewer.js +18 -0
- package/template/doc/viewer/codepanel/EzDocsCodePanel.js +51 -0
- package/template/doc/viewer/content/EzDocsContent.js +315 -0
- package/template/doc/viewer/header/EzDocsViewerHeader.js +46 -0
- package/template/doc/viewer/showcase/EzDocsShowcase.js +59 -0
- package/template/doc/viewer/showcase/EzDocsShowcaseSection.js +25 -0
- package/template/doc/viewer/showcase/EzDocsVariantItem.js +29 -0
- package/template/doc/welcome/EzDocsWelcome.js +48 -0
- package/themes/ez-theme.scss +179 -0
- package/themes/nature-fresh.scss +169 -0
- package/types/global.d.ts +21 -0
- package/utils/cssModules.js +81 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// EzGrid/body/EzGridCell.ts
|
|
2
|
+
|
|
3
|
+
import { EzGridContainer, EzGridContainerConfig } from '../EzGridContainer.js';
|
|
4
|
+
import type { NormalizedColumn, RowData } from '../types.js';
|
|
5
|
+
import type { EzGridSelection } from '../state/EzGridSelection.js';
|
|
6
|
+
import type { RowContext } from './EzGridRow.js';
|
|
7
|
+
|
|
8
|
+
export interface EzGridCellConfig extends EzGridContainerConfig {
|
|
9
|
+
row: any;
|
|
10
|
+
column: NormalizedColumn;
|
|
11
|
+
columnIndex?: number;
|
|
12
|
+
rowCtx?: RowContext | null;
|
|
13
|
+
selection?: EzGridSelection | null;
|
|
14
|
+
grid?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class EzGridCell extends EzGridContainer {
|
|
18
|
+
declare config: EzGridCellConfig;
|
|
19
|
+
|
|
20
|
+
row: any;
|
|
21
|
+
column: NormalizedColumn;
|
|
22
|
+
value: any;
|
|
23
|
+
|
|
24
|
+
constructor(config: EzGridCellConfig = {} as EzGridCellConfig) {
|
|
25
|
+
super(config);
|
|
26
|
+
|
|
27
|
+
const { row, column } = this.config;
|
|
28
|
+
|
|
29
|
+
this.row = row;
|
|
30
|
+
this.column = column || {} as NormalizedColumn;
|
|
31
|
+
|
|
32
|
+
// base class
|
|
33
|
+
this.config.cls = ['ez-grid-cell'] as any;
|
|
34
|
+
|
|
35
|
+
// width / flex
|
|
36
|
+
if (this.column.width != null) {
|
|
37
|
+
this.config.style = {
|
|
38
|
+
width: `${this.column.width}px`
|
|
39
|
+
};
|
|
40
|
+
} else {
|
|
41
|
+
this.config.flex = this.column.flex ?? 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.value = this.column.index
|
|
45
|
+
? this.row?.[this.column.index]
|
|
46
|
+
: null;
|
|
47
|
+
|
|
48
|
+
// decide content
|
|
49
|
+
this._buildContent();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async render(): Promise<HTMLDivElement> {
|
|
53
|
+
// CASE selection: define content BEFORE render
|
|
54
|
+
if (this.column.type === 'selection') {
|
|
55
|
+
const grid = this.config.grid;
|
|
56
|
+
const checked = grid?.isSelected?.(this.config.row);
|
|
57
|
+
const selectionWidth = this.column.width ?? 36;
|
|
58
|
+
|
|
59
|
+
this.config.style = {
|
|
60
|
+
width: `${selectionWidth}px`,
|
|
61
|
+
minWidth: `${selectionWidth}px`,
|
|
62
|
+
maxWidth: `${selectionWidth}px`,
|
|
63
|
+
display: 'flex',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center'
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
this.config.items = [{
|
|
69
|
+
eztype: 'input',
|
|
70
|
+
attrs: {
|
|
71
|
+
type: 'checkbox'
|
|
72
|
+
},
|
|
73
|
+
_ezAfterRender: (el: HTMLInputElement) => {
|
|
74
|
+
el.checked = !!checked;
|
|
75
|
+
},
|
|
76
|
+
onClick: (e: MouseEvent) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
grid?.toggleRow(this.config.row, this.config.rowCtx?.index);
|
|
79
|
+
}
|
|
80
|
+
}];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const el = await super.render();
|
|
84
|
+
|
|
85
|
+
const { row, column, rowCtx } = this.config;
|
|
86
|
+
const controller = (rowCtx?.grid as any)?.controller;
|
|
87
|
+
|
|
88
|
+
controller?.afterCellRender?.(
|
|
89
|
+
el,
|
|
90
|
+
this.value,
|
|
91
|
+
row,
|
|
92
|
+
column,
|
|
93
|
+
rowCtx
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return el;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private _buildContent(): void {
|
|
100
|
+
|
|
101
|
+
const { row, column, rowCtx } = this.config;
|
|
102
|
+
const value = this.value;
|
|
103
|
+
|
|
104
|
+
const controller = (rowCtx?.grid as any)?.controller;
|
|
105
|
+
|
|
106
|
+
const res = controller?.beforeCellRender?.(
|
|
107
|
+
value,
|
|
108
|
+
row,
|
|
109
|
+
column,
|
|
110
|
+
rowCtx
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (res === false) {
|
|
114
|
+
this.config.style = {
|
|
115
|
+
display: 'none'
|
|
116
|
+
};
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const col = this.column;
|
|
121
|
+
|
|
122
|
+
// 1️⃣ ACTIONS
|
|
123
|
+
if (col.type === 'actions') {
|
|
124
|
+
this._buildActions();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 2️⃣ CUSTOM RENDER
|
|
129
|
+
if (typeof col.render === 'function') {
|
|
130
|
+
const rendered = col.render(value, row, this as any);
|
|
131
|
+
|
|
132
|
+
if (rendered == null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// if returns EZ config
|
|
137
|
+
if (typeof rendered === 'object') {
|
|
138
|
+
this.config.items = [rendered];
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// string / number
|
|
143
|
+
this.config.items = [{
|
|
144
|
+
eztype: 'EzComponent',
|
|
145
|
+
cls: 'ez-grid-cell-inner',
|
|
146
|
+
text: String(rendered)
|
|
147
|
+
}];
|
|
148
|
+
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 3️⃣ WRAP (number of lines)
|
|
153
|
+
if (col.wrap) {
|
|
154
|
+
this._buildWrappedText(value, typeof col.wrap === 'number' ? col.wrap : 3);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 4️⃣ DEFAULT
|
|
159
|
+
this.config.items = [{
|
|
160
|
+
eztype: 'EzComponent',
|
|
161
|
+
cls: 'ez-grid-cell-inner',
|
|
162
|
+
text: value ?? ''
|
|
163
|
+
}];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private _buildWrappedText(value: any, lines: number = 3): void {
|
|
167
|
+
(this.config.cls as string[]).push('ez-grid-cell-wrap');
|
|
168
|
+
|
|
169
|
+
this.config.items = [{
|
|
170
|
+
eztype: 'EzComponent',
|
|
171
|
+
cls: 'ez-grid-cell-inner',
|
|
172
|
+
text: value ?? '',
|
|
173
|
+
style: {
|
|
174
|
+
webkitLineClamp: String(lines)
|
|
175
|
+
}
|
|
176
|
+
}];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private _buildActions(): void {
|
|
180
|
+
(this.config.cls as string[]).push('ez-grid-cell-actions');
|
|
181
|
+
this.config.layout = 'hbox';
|
|
182
|
+
|
|
183
|
+
this.config.items = ((this.column as any).actions || []).map((action: any) => {
|
|
184
|
+
let cfg = action;
|
|
185
|
+
|
|
186
|
+
if (typeof action === 'function') {
|
|
187
|
+
cfg = action(this.row, this);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!cfg) return null;
|
|
191
|
+
|
|
192
|
+
if (cfg.eztype) {
|
|
193
|
+
return cfg;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
eztype: 'EzComponent',
|
|
198
|
+
cls: [
|
|
199
|
+
'ez-grid-action',
|
|
200
|
+
cfg.danger && 'is-danger'
|
|
201
|
+
],
|
|
202
|
+
text: cfg.icon,
|
|
203
|
+
attrs: { title: cfg.tooltip },
|
|
204
|
+
onClick: (e: MouseEvent) => {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
cfg.onClick?.(this.row, this);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// EzGrid/body/EzGridRow.ts
|
|
2
|
+
|
|
3
|
+
import { EzGridContainer, EzGridContainerConfig } from '../EzGridContainer.js';
|
|
4
|
+
import type {
|
|
5
|
+
NormalizedColumn,
|
|
6
|
+
RowData,
|
|
7
|
+
RowKeyFn,
|
|
8
|
+
RowCallback,
|
|
9
|
+
RowContextMenuCallback,
|
|
10
|
+
RowRenderContext,
|
|
11
|
+
EzGridController,
|
|
12
|
+
EzGridRef
|
|
13
|
+
} from '../types.js';
|
|
14
|
+
import type { EzGridSelection } from '../state/EzGridSelection.js';
|
|
15
|
+
|
|
16
|
+
export type RowContext = RowRenderContext;
|
|
17
|
+
|
|
18
|
+
export interface EzGridRowConfig extends Omit<EzGridContainerConfig, 'controller'> {
|
|
19
|
+
row: RowData;
|
|
20
|
+
index?: number;
|
|
21
|
+
rowCount?: number;
|
|
22
|
+
columns?: NormalizedColumn[];
|
|
23
|
+
rowKey?: RowKeyFn;
|
|
24
|
+
selection?: EzGridSelection | null;
|
|
25
|
+
rowHeight?: number;
|
|
26
|
+
onRowClick?: RowCallback;
|
|
27
|
+
onRowDoubleClick?: RowCallback;
|
|
28
|
+
onRowContextMenu?: RowContextMenuCallback;
|
|
29
|
+
controller?: EzGridController;
|
|
30
|
+
grid?: EzGridRef;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class EzGridRow extends EzGridContainer {
|
|
34
|
+
declare config: EzGridRowConfig;
|
|
35
|
+
|
|
36
|
+
row: RowData;
|
|
37
|
+
columns: NormalizedColumn[];
|
|
38
|
+
selection: EzGridSelection | null;
|
|
39
|
+
rowId: string | number | null;
|
|
40
|
+
isSelected: boolean;
|
|
41
|
+
|
|
42
|
+
constructor(config: EzGridRowConfig = {} as EzGridRowConfig) {
|
|
43
|
+
super(config as EzGridContainerConfig);
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
row,
|
|
47
|
+
columns,
|
|
48
|
+
rowKey,
|
|
49
|
+
selection,
|
|
50
|
+
rowHeight
|
|
51
|
+
} = this.config;
|
|
52
|
+
|
|
53
|
+
this.row = row;
|
|
54
|
+
this.columns = columns || [];
|
|
55
|
+
this.selection = selection || null;
|
|
56
|
+
|
|
57
|
+
this.rowId = rowKey
|
|
58
|
+
? (typeof rowKey === 'function' ? rowKey(row) : (row as any)[rowKey as any])
|
|
59
|
+
: null;
|
|
60
|
+
|
|
61
|
+
this.isSelected =
|
|
62
|
+
this.rowId != null &&
|
|
63
|
+
!!this.selection?.selected?.has?.(String(this.rowId));
|
|
64
|
+
|
|
65
|
+
// base classes
|
|
66
|
+
this.config.cls = ['ez-grid-row'] as any;
|
|
67
|
+
if (this.isSelected) (this.config.cls as string[]).push('is-selected');
|
|
68
|
+
|
|
69
|
+
// horizontal layout
|
|
70
|
+
this.config.layout = 'hbox';
|
|
71
|
+
|
|
72
|
+
// fixed height (if exists)
|
|
73
|
+
if (rowHeight != null) {
|
|
74
|
+
this.config.style = {
|
|
75
|
+
height: `${rowHeight}px`,
|
|
76
|
+
minHeight: `${rowHeight}px`,
|
|
77
|
+
maxHeight: `${rowHeight}px`,
|
|
78
|
+
overflow: 'hidden'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// attrs
|
|
83
|
+
if (this.rowId != null) {
|
|
84
|
+
this.config.attrs = {
|
|
85
|
+
'data-ez-row-id': this.rowId
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// events
|
|
90
|
+
this._bindEvents();
|
|
91
|
+
|
|
92
|
+
// cells
|
|
93
|
+
this.config.items = this.columns.map((col, columnIndex) => ({
|
|
94
|
+
eztype: 'EzGridCell',
|
|
95
|
+
row: this.row,
|
|
96
|
+
column: col,
|
|
97
|
+
columnIndex,
|
|
98
|
+
rowCtx: null,
|
|
99
|
+
selection: this.selection,
|
|
100
|
+
grid: this.config.grid
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async render(): Promise<HTMLDivElement> {
|
|
106
|
+
const {
|
|
107
|
+
index,
|
|
108
|
+
row,
|
|
109
|
+
columns,
|
|
110
|
+
controller,
|
|
111
|
+
grid
|
|
112
|
+
} = this.config;
|
|
113
|
+
|
|
114
|
+
const rowCount = this.config.rowCount ?? 0;
|
|
115
|
+
|
|
116
|
+
const ctx: RowContext = {
|
|
117
|
+
index: index ?? 0,
|
|
118
|
+
row,
|
|
119
|
+
rowId: this.rowId,
|
|
120
|
+
columns: columns ?? [],
|
|
121
|
+
grid: grid as any,
|
|
122
|
+
rowEl: null,
|
|
123
|
+
|
|
124
|
+
isFirst: index === 0,
|
|
125
|
+
isLast: index === rowCount - 1
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
if (Array.isArray(this.config.items)) {
|
|
129
|
+
for (const item of this.config.items) {
|
|
130
|
+
(item as any).rowCtx = ctx;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const res = controller?.beforeRowRender?.(row, ctx);
|
|
135
|
+
|
|
136
|
+
if (res === false) {
|
|
137
|
+
const el = document.createElement('div');
|
|
138
|
+
el.style.display = 'none';
|
|
139
|
+
return el;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const el = await super.render();
|
|
143
|
+
|
|
144
|
+
ctx.rowEl = el;
|
|
145
|
+
|
|
146
|
+
controller?.afterRowRender?.(el, row, ctx);
|
|
147
|
+
|
|
148
|
+
if (this.config.grid?.isSelected?.(this.config.row)) {
|
|
149
|
+
el.classList.add('is-selected');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return el;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
private _bindEvents(): void {
|
|
157
|
+
const grid = this.config.grid;
|
|
158
|
+
|
|
159
|
+
// NOTE: Selection is handled by the onClick passed from EzGridBody._createRowConfig
|
|
160
|
+
// We only need to bind the double-click and context menu events here
|
|
161
|
+
|
|
162
|
+
// Wrap onRowClick if provided (user callback only, not selection)
|
|
163
|
+
const userOnRowClick = this.config.onRowClick;
|
|
164
|
+
if (userOnRowClick) {
|
|
165
|
+
const existingClick = this.config.onClick;
|
|
166
|
+
this.config.onClick = (e: MouseEvent) => {
|
|
167
|
+
if (typeof existingClick === 'function') {
|
|
168
|
+
existingClick(e, this);
|
|
169
|
+
}
|
|
170
|
+
userOnRowClick(this.config.row, {
|
|
171
|
+
rowKey: this.rowId,
|
|
172
|
+
index: this.config.index,
|
|
173
|
+
grid
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this.config.onDblClick = (e: MouseEvent) => {
|
|
179
|
+
this.config.onRowDoubleClick?.(this.config.row, {
|
|
180
|
+
rowKey: this.rowId,
|
|
181
|
+
index: this.config.index,
|
|
182
|
+
grid
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
this.config.onContextMenu = (e: MouseEvent) => {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
e.stopPropagation();
|
|
189
|
+
|
|
190
|
+
this.config.onRowContextMenu?.(this.config.row, {
|
|
191
|
+
rowKey: this.rowId,
|
|
192
|
+
grid
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ==========================================================
|
|
2
|
+
// EzGridFilters
|
|
3
|
+
// ==========================================================
|
|
4
|
+
|
|
5
|
+
.ez-grid-filters {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
|
|
9
|
+
background-color: var(--ez-grid-bg);
|
|
10
|
+
border-bottom: 1px solid var(--ez-grid-border-light);
|
|
11
|
+
|
|
12
|
+
min-height: 44px;
|
|
13
|
+
|
|
14
|
+
// ----------------------------------------------------------
|
|
15
|
+
// One filter cell per column
|
|
16
|
+
// ----------------------------------------------------------
|
|
17
|
+
.ez-grid-filter-cell {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
height: 44px;
|
|
23
|
+
padding: var(--ez-grid-cell-padding);
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
|
|
29
|
+
// Subtle vertical separator
|
|
30
|
+
&:not(:last-child)::after {
|
|
31
|
+
content: '';
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 10px;
|
|
34
|
+
right: 0;
|
|
35
|
+
width: 1px;
|
|
36
|
+
height: calc(100% - 20px);
|
|
37
|
+
background-color: var(--ez-grid-border-light);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// --------------------------------------------------------
|
|
41
|
+
// Default input styling
|
|
42
|
+
// --------------------------------------------------------
|
|
43
|
+
input,
|
|
44
|
+
select {
|
|
45
|
+
flex: 1;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
height: 32px;
|
|
48
|
+
|
|
49
|
+
padding: 0 10px;
|
|
50
|
+
|
|
51
|
+
font-size: var(--ez-grid-font-size);
|
|
52
|
+
font-weight: var(--ez-grid-font-weight);
|
|
53
|
+
color: var(--ez-grid-text);
|
|
54
|
+
|
|
55
|
+
background-color: var(--ez-grid-bg);
|
|
56
|
+
border: 1px solid var(--ez-grid-border);
|
|
57
|
+
border-radius: var(--ez-grid-radius-sm);
|
|
58
|
+
|
|
59
|
+
outline: none;
|
|
60
|
+
|
|
61
|
+
transition: border-color 0.15s ease,
|
|
62
|
+
box-shadow 0.15s ease;
|
|
63
|
+
|
|
64
|
+
&::placeholder {
|
|
65
|
+
color: var(--ez-grid-text-muted);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
border-color: var(--ez-grid-text-muted);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:focus {
|
|
73
|
+
border-color: var(--ez-grid-primary);
|
|
74
|
+
box-shadow: 0 0 0 2px var(--ez-grid-primary-light);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|