@mescius/wijmo.grid.cellmaker 5.20232.939
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/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +403 -0
- package/index.js +14 -0
- package/package.json +45 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* {@module wijmo.grid.cellmaker}
|
|
15
|
+
* Contains a {@link CellMaker} class that provides methods for creating
|
|
16
|
+
* cells with custom content such as Buttons, Hyperlinks, Images,
|
|
17
|
+
* Ratings, and Sparklines.
|
|
18
|
+
*
|
|
19
|
+
* To use these methods, assign their result to a column's
|
|
20
|
+
* {@link Column.cellTemplate} property.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export declare var ___keepComment: any;
|
|
26
|
+
import { ICellTemplateFunction, ICellTemplateContext } from '@grapecity/wijmo.grid';
|
|
27
|
+
/**
|
|
28
|
+
* Specifies parameters used to create cell elements.
|
|
29
|
+
*/
|
|
30
|
+
interface ICellMakerOptions {
|
|
31
|
+
/** Template string used to set the element's CSS class names. */
|
|
32
|
+
cssClass?: string;
|
|
33
|
+
/** Template string used to set the element's "aria-label" attribute. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Object with attributes to apply to the cell content element. */
|
|
36
|
+
attributes?: object;
|
|
37
|
+
/** Function to be executed when the element is clicked. */
|
|
38
|
+
click?: ICellMakerClickHandler;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Defines a handler for click events on custom cell content.
|
|
42
|
+
*/
|
|
43
|
+
interface ICellMakerClickHandler {
|
|
44
|
+
/**
|
|
45
|
+
* @param e <b>MouseEvent</b> that contains information about the click event.
|
|
46
|
+
* @param ctx {@link ICellTemplateContext} that contains information about the
|
|
47
|
+
* custom cell that was clicked.
|
|
48
|
+
*/
|
|
49
|
+
(e: MouseEvent, ctx: ICellTemplateContext): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Specifies parameters used to create cell buttons with the
|
|
53
|
+
* {@link CellMaker.makeButton} method.
|
|
54
|
+
*/
|
|
55
|
+
interface IButtonOptions extends ICellMakerOptions {
|
|
56
|
+
/** Template string used to set the element's display text. */
|
|
57
|
+
text?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Specifies parameters used to create cell hyperlinks with the
|
|
61
|
+
* {@link CellMaker.makeLink} method.
|
|
62
|
+
*/
|
|
63
|
+
interface ILinkOptions extends IButtonOptions {
|
|
64
|
+
/** Template string used to set the link's <b>href</b> attribute. */
|
|
65
|
+
href?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Specifies parameters used to create rating cells with the
|
|
69
|
+
* {@link CellMaker.makeRating} method.
|
|
70
|
+
*/
|
|
71
|
+
interface IRatingOptions extends ICellMakerOptions {
|
|
72
|
+
/**
|
|
73
|
+
* Range of the rating values, expressed as an array with two numbers
|
|
74
|
+
* (minimum and maximum ratings).
|
|
75
|
+
*
|
|
76
|
+
* The default value for this option is [0, 5].
|
|
77
|
+
*/
|
|
78
|
+
range?: number[];
|
|
79
|
+
/**
|
|
80
|
+
* Whether to show symbols for zero ratings.
|
|
81
|
+
*
|
|
82
|
+
* The default value for this option is false, which causes the zero
|
|
83
|
+
* symbol not to be displayed. Users may still click the area to the
|
|
84
|
+
* left of the first symbol to give the cell a zero rating.
|
|
85
|
+
*/
|
|
86
|
+
showZeros?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Specifies constants that define Sparkline types.
|
|
90
|
+
*/
|
|
91
|
+
export declare enum SparklineType {
|
|
92
|
+
/** A mini line chart. */
|
|
93
|
+
Line = 0,
|
|
94
|
+
/** A mini column chart. */
|
|
95
|
+
Column = 1,
|
|
96
|
+
/** A mini column chart that shows only three values: positive, negative, and zero. */
|
|
97
|
+
WinLoss = 2
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Specifies constants that define Sparkline markers.
|
|
101
|
+
*/
|
|
102
|
+
export declare enum SparklineMarkers {
|
|
103
|
+
/** No markers. */
|
|
104
|
+
None = 0,
|
|
105
|
+
/** Add marker to first point. */
|
|
106
|
+
First = 1,
|
|
107
|
+
/** Add marker to last point. */
|
|
108
|
+
Last = 2,
|
|
109
|
+
/** Add marker to highest-value points. */
|
|
110
|
+
High = 4,
|
|
111
|
+
/** Add marker to lowest-value points. */
|
|
112
|
+
Low = 8,
|
|
113
|
+
/** Add marker to negative-value points. */
|
|
114
|
+
Negative = 16
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Specifies parameters used to create Sparkline cells with the
|
|
118
|
+
* {@link CellMaker.makeSparkline} method.
|
|
119
|
+
*/
|
|
120
|
+
interface ISparkLineOptions extends ICellMakerOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Type of Sparkline to create.
|
|
123
|
+
*
|
|
124
|
+
* The default type is {@link SparklineType.Line}.
|
|
125
|
+
*/
|
|
126
|
+
type?: SparklineType;
|
|
127
|
+
/**
|
|
128
|
+
* Markers to add to Sparkline points.
|
|
129
|
+
*/
|
|
130
|
+
markers?: SparklineMarkers;
|
|
131
|
+
/**
|
|
132
|
+
* Base value (position of the Y-axis) on a sparkline.
|
|
133
|
+
*
|
|
134
|
+
* Setting this value to null causes the chart to calculate the base value
|
|
135
|
+
* automatically so the chart fills the vertical extent of the cell.
|
|
136
|
+
* This is a good option to highlight relative changes, and is used by
|
|
137
|
+
* default for Sparklines of type {@link SparklineType.Line}.
|
|
138
|
+
*
|
|
139
|
+
* Setting this value to an absolute number (like zero) is a better option
|
|
140
|
+
* to show absolute changes, and is used by default for Sparklines of type
|
|
141
|
+
* {@link SparklineType.Column}.
|
|
142
|
+
*/
|
|
143
|
+
baseValue?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Maximum number of points to use in the sparkline or sparkbar.
|
|
146
|
+
*
|
|
147
|
+
* Setting this value to null causes the cell to show all points.
|
|
148
|
+
*/
|
|
149
|
+
maxPoints?: number;
|
|
150
|
+
}
|
|
151
|
+
interface _IScaledValues {
|
|
152
|
+
min: number;
|
|
153
|
+
max: number;
|
|
154
|
+
base: number;
|
|
155
|
+
points: number[];
|
|
156
|
+
data: number[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Provides methods for creating cells with custom content such as
|
|
160
|
+
* Buttons, Hyperlinks, Images, Ratings, and Sparklines.
|
|
161
|
+
*
|
|
162
|
+
* To use these methods, assign their result to a column's
|
|
163
|
+
* {@link Column.cellTemplate} property.
|
|
164
|
+
*/
|
|
165
|
+
export declare class CellMaker {
|
|
166
|
+
static _WJC_CellMaker: string;
|
|
167
|
+
/**
|
|
168
|
+
* Creates a cell template with a button.
|
|
169
|
+
*
|
|
170
|
+
* By default, the button displays the cell's bound text in it.
|
|
171
|
+
* If you want to show a fixed string, set the <b>options.text</b>
|
|
172
|
+
* property to the string you want to show.
|
|
173
|
+
*
|
|
174
|
+
* For example, the code below defines a column with button elements.
|
|
175
|
+
* All buttons show the same text ('Click Me') and show an alert when
|
|
176
|
+
* clicked:
|
|
177
|
+
*
|
|
178
|
+
* ```typescript
|
|
179
|
+
* new FlexGrid('#theGrid', {
|
|
180
|
+
* autoGenerateColumns: false,
|
|
181
|
+
* columns: [
|
|
182
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
183
|
+
* {
|
|
184
|
+
* binding: 'country',
|
|
185
|
+
* header: 'My Buttons',
|
|
186
|
+
* cellTemplate: CellMaker.makeButton({
|
|
187
|
+
* text: 'Click Me', // override bound text
|
|
188
|
+
* click: (e: MouseEvent, ctx: ICellTemplateContext) => {
|
|
189
|
+
* alert('Clicked Button ** ' + ctx.item.country + ' **')
|
|
190
|
+
* }
|
|
191
|
+
* })
|
|
192
|
+
* }
|
|
193
|
+
* ]
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* To avoid disrupting the regular tab navigation, the button's
|
|
198
|
+
* **tabindex** attribute is set to -1 by default.
|
|
199
|
+
*
|
|
200
|
+
* If you want to include the buttons in the tab navigation,
|
|
201
|
+
* use the **attributes** option to set their **tabindex**
|
|
202
|
+
* attribute to zero. For example:
|
|
203
|
+
*
|
|
204
|
+
* ```typescript
|
|
205
|
+
* new FlexGrid('#theGrid', {
|
|
206
|
+
* autoGenerateColumns: false,
|
|
207
|
+
* columns: [
|
|
208
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
209
|
+
* {
|
|
210
|
+
* binding: 'country',
|
|
211
|
+
* header: 'My Buttons',
|
|
212
|
+
* cellTemplate: CellMaker.makeButton({
|
|
213
|
+
* text: 'Click Me', // override bound text
|
|
214
|
+
* click: (e: MouseEvent, ctx: ICellTemplateContext) => {
|
|
215
|
+
* alert('Clicked Button ** ' + ctx.item.country + ' **')
|
|
216
|
+
* },
|
|
217
|
+
* attributes: {
|
|
218
|
+
* tabindex: 0 // make button a tab stop
|
|
219
|
+
* }
|
|
220
|
+
* })
|
|
221
|
+
* }
|
|
222
|
+
* ]
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* For details on links and button elements, please visit
|
|
227
|
+
* https://css-tricks.com/a-complete-guide-to-links-and-buttons/.
|
|
228
|
+
*
|
|
229
|
+
* @param options {@link IButtonOptions} object containing parameters for the button.
|
|
230
|
+
* @returns An {@link ICellTemplateFunction} to be assigned to a column's {@link Column.cellTemplate} property.
|
|
231
|
+
*/
|
|
232
|
+
static makeButton(options?: IButtonOptions): ICellTemplateFunction;
|
|
233
|
+
/**
|
|
234
|
+
* Creates a cell template with a hyperlink.
|
|
235
|
+
*
|
|
236
|
+
* By default, the link displays the cell's bound text in it.
|
|
237
|
+
* If you want to show a fixed string, set the <b>options.text</b>
|
|
238
|
+
* property to the string you want to show.
|
|
239
|
+
*
|
|
240
|
+
* For example, the code below defines a column with hyperlink elements.
|
|
241
|
+
* The links show some custom text and link to a url from the cell's
|
|
242
|
+
* data item:
|
|
243
|
+
*
|
|
244
|
+
* ```typescript
|
|
245
|
+
* new FlexGrid('#theGrid', {
|
|
246
|
+
* autoGenerateColumns: false,
|
|
247
|
+
* columns: [
|
|
248
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
249
|
+
* {
|
|
250
|
+
* binding: 'country',
|
|
251
|
+
* header: 'My Links',
|
|
252
|
+
* cellTemplate: CellMaker.makeLink({
|
|
253
|
+
* text: 'Visit ${item.country}', // override bound text
|
|
254
|
+
* href: '${item.url}', // bound link destination
|
|
255
|
+
* attributes: {
|
|
256
|
+
* tabindex: 0 // make hyperlink a tab stop
|
|
257
|
+
* }
|
|
258
|
+
* })
|
|
259
|
+
* }
|
|
260
|
+
* ]
|
|
261
|
+
* });
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* To avoid disrupting the regular tab navigation, the hyperlink's
|
|
265
|
+
* **tabindex** attribute is set to -1 by default.
|
|
266
|
+
*
|
|
267
|
+
* If you want to include the hyperlinks in the tab navigation,
|
|
268
|
+
* use the **attributes** option to set their **tabindex**
|
|
269
|
+
* attribute to zero. For example:
|
|
270
|
+
*
|
|
271
|
+
* ```typescript
|
|
272
|
+
* new FlexGrid('#theGrid', {
|
|
273
|
+
* autoGenerateColumns: false,
|
|
274
|
+
* columns: [
|
|
275
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
276
|
+
* {
|
|
277
|
+
* binding: 'country',
|
|
278
|
+
* header: 'My Links',
|
|
279
|
+
* cellTemplate: CellMaker.makeLink({
|
|
280
|
+
* text: 'Visit ${item.country}', // override bound text
|
|
281
|
+
* href: '${item.url}', // bound link destination
|
|
282
|
+
* // no need for click handler, the link navigates automatically
|
|
283
|
+
* })
|
|
284
|
+
* }
|
|
285
|
+
* ]
|
|
286
|
+
* });
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* For details on links and button elements, please visit
|
|
290
|
+
* https://css-tricks.com/a-complete-guide-to-links-and-buttons/.
|
|
291
|
+
*
|
|
292
|
+
* @param options {@link ILinkOptions} object containing parameters for the hyperlink.
|
|
293
|
+
* @returns An {@link ICellTemplateFunction} to be assigned to a column's {@link Column.cellTemplate} property.
|
|
294
|
+
*/
|
|
295
|
+
static makeLink(options?: ILinkOptions): ICellTemplateFunction;
|
|
296
|
+
/**
|
|
297
|
+
* Creates a cell template with a sparkline.
|
|
298
|
+
*
|
|
299
|
+
* The cell should be bound to an array of numbers to be shown as a
|
|
300
|
+
* mini line chart.
|
|
301
|
+
*
|
|
302
|
+
* For example, the code below defines a column with sparklines
|
|
303
|
+
* showing the content of the 'history' array in the cell's data item.
|
|
304
|
+
* You may customize the appearance of the sparklines using CSS:
|
|
305
|
+
*
|
|
306
|
+
* ```typescript
|
|
307
|
+
* new FlexGrid('#theGrid', {
|
|
308
|
+
* autoGenerateColumns: false,
|
|
309
|
+
* columns: [
|
|
310
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
311
|
+
* {
|
|
312
|
+
* binding: 'history',
|
|
313
|
+
* header: 'History Sparklines',
|
|
314
|
+
* width: 175,
|
|
315
|
+
* cellTemplate: CellMaker.makeSparkline({
|
|
316
|
+
* markers: SparklineMarkers.High | SparklineMarkers.Low, // add markers
|
|
317
|
+
* maxPoints: 25, // limit number of points
|
|
318
|
+
* label: '${item.country} sales history line chart', // accessibility
|
|
319
|
+
* })
|
|
320
|
+
* }
|
|
321
|
+
* ]
|
|
322
|
+
* });
|
|
323
|
+
* ```
|
|
324
|
+
* @param options {@link ISparkLineOptions} object containing parameters for the Sparkline.
|
|
325
|
+
* It should include the <b>label</b> property for accessibility.
|
|
326
|
+
* @returns An {@link ICellTemplateFunction} to be assigned to a column's {@link Column.cellTemplate} property.
|
|
327
|
+
*/
|
|
328
|
+
static makeSparkline(options?: ISparkLineOptions): ICellTemplateFunction;
|
|
329
|
+
/**
|
|
330
|
+
* Creates a cell template with an image.
|
|
331
|
+
*
|
|
332
|
+
* The cell should be bound to a string containing an image URL.
|
|
333
|
+
*
|
|
334
|
+
* For example, the code below defines a column with images located
|
|
335
|
+
* at urls specified by the 'img' member of the data items:
|
|
336
|
+
*
|
|
337
|
+
* ```typescript
|
|
338
|
+
* new FlexGrid('#theGrid', {
|
|
339
|
+
* autoGenerateColumns: false,
|
|
340
|
+
* columns: [
|
|
341
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
342
|
+
* {
|
|
343
|
+
* binding: 'img',
|
|
344
|
+
* header: 'Images',
|
|
345
|
+
* cssClass: 'cell-img',
|
|
346
|
+
* cellTemplate: CellMaker.makeImage({
|
|
347
|
+
* label: 'image for ${item.country}', // accessibility
|
|
348
|
+
* click: (e, ctx) => alert('Clicked image for ' + ctx.item.country)
|
|
349
|
+
* })
|
|
350
|
+
* }
|
|
351
|
+
* ]
|
|
352
|
+
* });
|
|
353
|
+
* ```
|
|
354
|
+
* @param options {@link ICellMakerOptions} object containing parameters for the image.
|
|
355
|
+
* It should include the <b>label</b> property for accessibility.
|
|
356
|
+
* @returns An {@link ICellTemplateFunction} to be assigned to a column's {@link Column.cellTemplate} property.
|
|
357
|
+
*/
|
|
358
|
+
static makeImage(options?: ICellMakerOptions): ICellTemplateFunction;
|
|
359
|
+
/**
|
|
360
|
+
* Creates a cell template to show and edit a rating value.
|
|
361
|
+
*
|
|
362
|
+
* The cell should be bound to a string containing a number that
|
|
363
|
+
* represents a rating.
|
|
364
|
+
*
|
|
365
|
+
* By default, cells show ratings as stars. You may customize
|
|
366
|
+
* the appearance of rating cells using CSS.
|
|
367
|
+
*
|
|
368
|
+
* For example, the code below defines a column with stars that
|
|
369
|
+
* show the 'rating' member of the data items.
|
|
370
|
+
* Since the column is not read-only, users may edit the ratings
|
|
371
|
+
* using the keyboard or the mouse:
|
|
372
|
+
*
|
|
373
|
+
* ```typescript
|
|
374
|
+
* new FlexGrid('#theGrid', {
|
|
375
|
+
* autoGenerateColumns: false,
|
|
376
|
+
* columns: [
|
|
377
|
+
* { binding: 'id', header: 'ID', isReadOnly: true },
|
|
378
|
+
* {
|
|
379
|
+
* binding: 'rating',
|
|
380
|
+
* header: 'Rating (editable)',
|
|
381
|
+
* width: 220,
|
|
382
|
+
* align: 'center',
|
|
383
|
+
* cellTemplate: CellMaker.makeRating({
|
|
384
|
+
* range: [0, 5], // rating values between 0 and 5
|
|
385
|
+
* label: 'Edit Product Rating'
|
|
386
|
+
* })
|
|
387
|
+
* }
|
|
388
|
+
* ]
|
|
389
|
+
* });
|
|
390
|
+
* ```
|
|
391
|
+
* @param options {@link IRatingOptions} object containing parameters for the rating cell.
|
|
392
|
+
* @returns An {@link ICellTemplateFunction} to be assigned to a column's {@link Column.cellTemplate} property.
|
|
393
|
+
*/
|
|
394
|
+
static makeRating(options?: IRatingOptions): ICellTemplateFunction;
|
|
395
|
+
static _getOptionText(options: any, option: string, ctx: ICellTemplateContext, defVal?: string): string;
|
|
396
|
+
static _createElement(cell: HTMLElement, html: string, options: ICellMakerOptions, ctx: ICellTemplateContext): HTMLElement;
|
|
397
|
+
static _cloneContext(ctx: ICellTemplateContext): ICellTemplateContext;
|
|
398
|
+
static _handleClick(e: MouseEvent): void;
|
|
399
|
+
static _getSparkline(data: number[], options: ISparkLineOptions): string;
|
|
400
|
+
static _scaleValues(data: number[], baseVal: number, maxPoints: number): _IScaledValues;
|
|
401
|
+
static _getMarkers(markers: SparklineMarkers, values: _IScaledValues, index: number): string;
|
|
402
|
+
}
|
|
403
|
+
export {};
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(r[t]=e[t]);r.default=e;return r};Object.defineProperty(exports,"__esModule",{value:!0});var SparklineType,SparklineMarkers,wijmo_1=require("@mescius/wijmo"),wijmo_grid_1=require("@mescius/wijmo.grid"),selfModule=__importStar(require("@mescius/wijmo.grid.cellmaker"));!function(e){e[e.Line=0]="Line";e[e.Column=1]="Column";e[e.WinLoss=2]="WinLoss"}(SparklineType=exports.SparklineType||(exports.SparklineType={}));!function(e){e[e.None=0]="None";e[e.First=1]="First";e[e.Last=2]="Last";e[e.High=4]="High";e[e.Low=8]="Low";e[e.Negative=16]="Negative"}(SparklineMarkers=exports.SparklineMarkers||(exports.SparklineMarkers={}));var CellMaker=function(){function CellMaker(){}CellMaker.makeButton=function(e){return function(r,t){r.col.isReadOnly=!0;t.innerHTML="";var a=wijmo_1.format('<button type="button" tabindex="-1">{txt}</button>',{txt:CellMaker._getOptionText(e,"text",r,r.text)});CellMaker._createElement(t,a,e,r);return null}};CellMaker.makeLink=function(e){return function(r,t){r.col.isReadOnly=!0;t.innerHTML="";var a=wijmo_1.format('<a href="{href}" tabindex="-1">{txt}</a>',{txt:CellMaker._getOptionText(e,"text",r,r.text),href:CellMaker._getOptionText(e,"href",r,"#")});CellMaker._createElement(t,a,e,r);return null}};CellMaker.makeSparkline=function(e){return function(r,t){r.col.isReadOnly=!0;t.innerHTML="";var a=wijmo_1.format("<div><svg><g>{spark}</g></svg></div>",{spark:CellMaker._getSparkline(r.value,e)});CellMaker._createElement(t,a,e,r);return null}};CellMaker.makeImage=function(e){return function(r,t){r.col.isReadOnly=!0;t.innerHTML="";var a=wijmo_1.format('<img src="{src}"></div>',{src:CellMaker._getOptionText(e,"src",r,r.text)});CellMaker._createElement(t,a,e,r);return null}};CellMaker.makeRating=function(e){return function(r,t){var a=r.col,l=wijmo_grid_1.DataMapEditor,i=a.cssClass||"",n=CellMaker._WJC_CellMaker;if(!a.dataMap||a.dataMapEditor!=l.RadioButtons||i.indexOf(n)<0){for(var o=e?e.range:null,s=[],u=(o=o&&wijmo_1.isArray(o)&&o.length>1&&o[1]>o[0]?o:[0,5])[0];u<=o[1];u++)s.push(u);a.dataMap=new wijmo_grid_1.DataMap(s);a.dataMapEditor=l.RadioButtons;i.indexOf(n)<0&&(a.cssClass=(i+" "+n).trim())}if(e&&e.label){var c=CellMaker._getOptionText(e,"label",r);t.setAttribute("aria-label",c.trim())}var m=t.querySelectorAll("label"),k=!!e&&e.showZeros,M=null==t.querySelector("input:checked");for(u=0;u<m.length;u++){var _=(c=m[u]).querySelector("input");wijmo_1.toggleClass(c,"wj-chk-hidden","0"==_.value&&!k);wijmo_1.toggleClass(c,"wj-chk-off",M);M=M||null!=c.querySelector("input:checked")}return null}};CellMaker._getOptionText=function(e,r,t,a){void 0===a&&(a="");var l=e?e[r]:"";return l?wijmo_1.evalTemplate(l,t):a};CellMaker._createElement=function(e,r,t,a){var l=wijmo_1.createElement(r,e),i=CellMaker._WJC_CellMaker;t&&t.cssClass&&(i+=" "+CellMaker._getOptionText(t,"cssClass",a));l.className=i.trim();if(t&&t.label){var n=CellMaker._getOptionText(t,"label",a);l.setAttribute("aria-label",n.trim());l instanceof HTMLImageElement&&l.setAttribute("alt",n.trim())}if(t&&t.attributes)for(var o in t.attributes)l.setAttribute(o,t.attributes[o]);t&&wijmo_1.isFunction(t.click)&&(l.onclick=CellMaker._handleClick.bind({options:t,ctx:CellMaker._cloneContext(a)}));return l};CellMaker._cloneContext=function(e){if(wijmo_1.isFunction(Object.assign))return Object.assign({},e);var r={};for(var t in e)r[t]=e[t];return r};CellMaker._handleClick=function(e){var r=this.options;if(wijmo_1.isFunction(r.click)){e.preventDefault();var t=this.ctx;r.click(e,t)}};CellMaker._getSparkline=function(e,r){var t="",a=SparklineType,l=SparklineMarkers,i=null!=(r=r||{}).type?r.type:a.Line,n=null!=r.markers?r.markers:l.None,o=wijmo_1.isNumber(r.baseValue)?r.baseValue:i==a.Line?null:0,s=wijmo_1.isNumber(r.maxPoints)?r.maxPoints:null;if(e instanceof Array&&e.length>1){i==a.WinLoss&&(e=e.map((function(e){return wijmo_1.isBoolean(e)?e?1:-1:wijmo_1.isNumber(e)?e>0?1:e<0?-1:null:null})));var u=CellMaker._scaleValues(e,o,s),c=u.points,m=u.base,k=100/(c.length-(i==a.Line?1:0)),M=k>4?k-2:k,_=k-M;switch(i){case a.Column:case a.WinLoss:for(var f=0;f<c.length;f++){var p=c[f];null!=p&&(t+=wijmo_1.format("<rect {cls}x={x}% y={y}% width={w}% height={h}% />",{x:(f*k+_).toFixed(2),y:Math.min(m,p),w:M.toFixed(2),h:Math.abs(m-p),cls:CellMaker._getMarkers(n,u,f)}))}break;case a.Line:for(f=0;f<c.length-1;f++){var g=c[f],C=c[f+1];null!=g&&null!=C&&(t+=wijmo_1.format("<line x1={x1}% y1={y1}% x2={x2}% y2={y2}% />",{x1:Math.round(k*f),y1:g,x2:Math.round(k*(f+1)),y2:C}));var x=CellMaker._getMarkers(n,u,f),d='<circle {cls}cx={x}% cy={y}% r="3"/>';x&&(t+=wijmo_1.format(d,{x:Math.round(k*f),y:g,cls:x}));f==c.length-2&&(x=CellMaker._getMarkers(n,u,f+1))&&(t+=wijmo_1.format(d,{x:Math.round(k*(f+1)),y:C,cls:x}))}}null!=o&&i!=a.WinLoss&&(t+=wijmo_1.format('<line class="x-axis" x1=0% y1={base}% x2=100% y2={base}% />',{base:u.base}))}return t};CellMaker._scaleValues=function(e,r,t){var a,l,i=[];t&&t>1&&e.length>t&&(e=e.slice(0,t));e.forEach((function(e){if(wijmo_1.isNumber(e)){a=!wijmo_1.isNumber(a)||e<a?e:a;l=!wijmo_1.isNumber(l)||e>l?e:l}}));if(wijmo_1.isNumber(a)&&wijmo_1.isNumber(l)){if(null!=r){a=Math.min(a,r);l=Math.max(l,r)}else r=a>0?a:l<0?l:0;if(a==l){a--;l++}var n=l-a;e.forEach((function(e){i.push(wijmo_1.isNumber(e)?100-Math.round((e-a)/n*100):null)}));r=100-Math.round((r-a)/n*100)}return{min:a,max:l,base:r,points:i,data:e}};CellMaker._getMarkers=function(e,r,t){var a="",l=SparklineMarkers;if(e){var i=r.data,n="wj-marker-";0!=(e&l.First)&&0==t&&(a+=n+"first ");0!=(e&l.Last)&&t==i.length-1&&(a+=n+"last ");0!=(e&l.High)&&i[t]==r.max&&(a+=n+"high ");0!=(e&l.Low)&&i[t]==r.min&&(a+=n+"low ");0!=(e&l.Negative)&&i[t]<0&&(a+=n+"negative ")}return a?'class="wj-marker '+a.trim()+'"':""};CellMaker._WJC_CellMaker="wj-cell-maker";return CellMaker}();exports.CellMaker=CellMaker;wijmo_1._registerModule("wijmo.grid.cellmaker",selfModule);
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mescius/wijmo.grid.cellmaker",
|
|
3
|
+
"version": "5.20232.939",
|
|
4
|
+
"description": "UI library for pure JS, Angular, React, Vue and more...",
|
|
5
|
+
"author": "MESCIUS inc",
|
|
6
|
+
"license": "Commercial",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@mescius/wijmo": "5.20232.939",
|
|
11
|
+
"@mescius/wijmo.grid": "5.20232.939"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://developer.mescius.com/wijmo",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://developer.mescius.com/forums/wijmo"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"control",
|
|
19
|
+
"component",
|
|
20
|
+
"ui",
|
|
21
|
+
"control library",
|
|
22
|
+
"component library",
|
|
23
|
+
"ui library",
|
|
24
|
+
"control-library",
|
|
25
|
+
"component-library",
|
|
26
|
+
"ui-library",
|
|
27
|
+
"grid",
|
|
28
|
+
"data grid",
|
|
29
|
+
"data-grid",
|
|
30
|
+
"datagrid",
|
|
31
|
+
"angular grid",
|
|
32
|
+
"react grid",
|
|
33
|
+
"vue grid",
|
|
34
|
+
"angular-grid",
|
|
35
|
+
"react-grid",
|
|
36
|
+
"vue-grid"
|
|
37
|
+
],
|
|
38
|
+
"module": "./es5-esm.js",
|
|
39
|
+
"esm5": "./es5-esm.js",
|
|
40
|
+
"wj-esm5": "./es5-esm.js",
|
|
41
|
+
"es2015Cjs": "./es2015-commonjs.js",
|
|
42
|
+
"wj-es2015Cjs": "./es2015-commonjs.js",
|
|
43
|
+
"esm2015": "./es2015-esm.js",
|
|
44
|
+
"wj-esm2015": "./es2015-esm.js"
|
|
45
|
+
}
|