Skip to content

Commit d23a51e

Browse files
committed
feat: allow icon to be colored
1 parent f55653a commit d23a51e

File tree

5 files changed

+40
-34
lines changed

5 files changed

+40
-34
lines changed

lib/calendar.svg

Lines changed: 0 additions & 14 deletions
This file was deleted.

lib/renderer.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1-
import type {
2-
ColumnDataSchemaModel,
3-
HyperFunc,
4-
VNode,
1+
import {
2+
type ColumnDataSchemaModel,
3+
type HyperFunc,
4+
type VNode,
55
} from '@revolist/revogrid';
66

7+
const svg = `<svg aria-hidden="true" viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
8+
<g fill="none" fill-rule="evenodd" transform="translate(2 2)">
9+
<path d="m2.5.5h12c1.1045695 0 2 .8954305 2 2v12c0 1.1045695-.8954305 2-2 2h-12c-1.1045695 0-2-.8954305-2-2v-12c0-1.1045695.8954305-2 2-2z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
10+
<path d="m.5 4.5h16" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
11+
<g fill="currentColor">
12+
<circle cx="8.5" cy="8.5" r="1"></circle>
13+
<circle cx="4.5" cy="8.5" r="1"></circle>
14+
<circle cx="12.5" cy="8.5" r="1"></circle>
15+
<circle cx="8.5" cy="12.5" r="1"></circle>
16+
<circle cx="4.5" cy="12.5" r="1"></circle>
17+
<circle cx="12.5" cy="12.5" r="1"></circle>
18+
</g>
19+
</g>
20+
</svg>
21+
`;
22+
723
export const ColumnRenderer = (
824
h: HyperFunc<VNode>,
925
{ model, prop }: ColumnDataSchemaModel,
1026
): VNode[] => {
1127
let val = model[prop];
1228
return [
1329
h('div', { class: { 'cell-value-wrapper': true } }, [val]),
14-
h('span', {
30+
h('button', {
1531
class: { calendar: true },
32+
innerHTML: svg,
1633
onClick: (e: MouseEvent) => {
1734
const ev = new MouseEvent('dblclick', {
1835
bubbles: true,

lib/style.css

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@
4343

4444
revogr-data .calendar {
4545
position: absolute;
46-
right: 5px;
46+
right: 0;
4747
top: 0;
48-
width: 20px;
48+
border: 0;
49+
width: 24px;
4950
height: 100%;
50-
background: url(calendar.svg);
51-
52-
background-size: 14px;
53-
background-repeat: no-repeat;
54-
background-position: center;
5551
opacity: .5;
52+
text-align: center;
53+
background-color: transparent;
54+
55+
svg {
56+
width: 14px;
57+
vertical-align: middle;
58+
}
5659
}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@revolist/revogrid-column-date",
3-
"version": "2.0.22",
3+
"version": "2.0.23",
44
"description": "Date format for RevoGrid system based on duetds-date-picker",
55
"module": "./dist/revogrid-column-date.js",
66
"main": "./dist/revogrid-column-date.umd.cjs",
@@ -51,7 +51,7 @@
5151
"license": "MIT",
5252
"devDependencies": {
5353
"@duetds/date-picker": "^1.4.0",
54-
"@revolist/revogrid": "^4.8.13",
54+
"@revolist/revogrid": "^4.10.1",
5555
"@types/lodash": "^4.14.149",
5656
"lodash": "4.17.20",
5757
"typescript": "^5.2.2",

0 commit comments

Comments
 (0)