@vuu-ui/vuu-data-test 2.1.0-alpha.3 → 2.1.0-alpha.5
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/cjs/SessionTable.js +6 -2
- package/cjs/SessionTable.js.map +1 -1
- package/esm/SessionTable.js +6 -2
- package/esm/SessionTable.js.map +1 -1
- package/package.json +6 -6
package/cjs/SessionTable.js
CHANGED
|
@@ -11,7 +11,6 @@ const SessionTable = (table, sessionId) => {
|
|
|
11
11
|
const update = (key, columnName, value) => {
|
|
12
12
|
const row = table.findByKey(key);
|
|
13
13
|
if (row) {
|
|
14
|
-
const colIndex = table.map[columnName];
|
|
15
14
|
const tsIndex = table.map.vuuUpdatedTimestamp;
|
|
16
15
|
let updatesForRow = updates.get(key);
|
|
17
16
|
if (updatesForRow === void 0) {
|
|
@@ -23,7 +22,12 @@ const SessionTable = (table, sessionId) => {
|
|
|
23
22
|
}
|
|
24
23
|
updatesForRow.cellUpdates[columnName] = value;
|
|
25
24
|
const newRow = row.slice();
|
|
26
|
-
|
|
25
|
+
for (const [columnName2, value2] of Object.entries(
|
|
26
|
+
updatesForRow.cellUpdates
|
|
27
|
+
)) {
|
|
28
|
+
const colIndex = table.map[columnName2];
|
|
29
|
+
newRow[colIndex] = value2;
|
|
30
|
+
}
|
|
27
31
|
table.emit("update", newRow, columnName, sessionId);
|
|
28
32
|
} else {
|
|
29
33
|
console.warn(`SessionTable update row ${key} not found`);
|
package/cjs/SessionTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionTable.js","sources":["../../../packages/vuu-data-test/src/SessionTable.ts"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { Table } from \"./Table\";\n\ntype RowUpdates = {\n cellUpdates: Record<string, VuuRowDataItemType>;\n lastUpdateTimestamp?: number;\n};\n\nexport type SessionTable = Table & {\n getSessionUpdates: () => Map<string, RowUpdates>;\n};\nexport const SessionTable = (table: Table, sessionId: string): SessionTable => {\n const updates = new Map<string, RowUpdates>();\n\n const getSessionUpdates = () => {\n return updates;\n };\n\n // we need to intercept this as addEventListener accesses a private\n // member, so has to be invoked by table itself.\n const addEventListener = (event: string, handler: unknown) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n table.on(event, handler);\n };\n\n const update = (\n key: string,\n columnName: string,\n value: VuuRowDataItemType,\n ) => {\n // we don't actually apply the update to the table, but we emit the updated event, so the bound\n // dataSource will update its own cache\n const row = table.findByKey(key);\n if (row) {\n const
|
|
1
|
+
{"version":3,"file":"SessionTable.js","sources":["../../../packages/vuu-data-test/src/SessionTable.ts"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { Table } from \"./Table\";\n\ntype RowUpdates = {\n cellUpdates: Record<string, VuuRowDataItemType>;\n lastUpdateTimestamp?: number;\n};\n\nexport type SessionTable = Table & {\n getSessionUpdates: () => Map<string, RowUpdates>;\n};\nexport const SessionTable = (table: Table, sessionId: string): SessionTable => {\n const updates = new Map<string, RowUpdates>();\n\n const getSessionUpdates = () => {\n return updates;\n };\n\n // we need to intercept this as addEventListener accesses a private\n // member, so has to be invoked by table itself.\n const addEventListener = (event: string, handler: unknown) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n table.on(event, handler);\n };\n\n const update = (\n key: string,\n columnName: string,\n value: VuuRowDataItemType,\n ) => {\n // we don't actually apply the update to the table, but we emit the updated event, so the bound\n // dataSource will update its own cache\n const row = table.findByKey(key);\n if (row) {\n const tsIndex = table.map.vuuUpdatedTimestamp;\n\n let updatesForRow = updates.get(key);\n if (updatesForRow === undefined) {\n updatesForRow = {\n lastUpdateTimestamp: row[tsIndex] as number | undefined,\n cellUpdates: {},\n };\n updates.set(key, updatesForRow);\n }\n updatesForRow.cellUpdates[columnName] = value;\n\n const newRow = row.slice();\n\n for (const [columnName, value] of Object.entries(\n updatesForRow.cellUpdates,\n )) {\n const colIndex = table.map[columnName];\n newRow[colIndex] = value;\n }\n\n table.emit(\"update\", newRow, columnName, sessionId);\n } else {\n console.warn(`SessionTable update row ${key} not found`);\n }\n };\n\n return new Proxy(table, {\n get(_obj, prop: string | symbol) {\n if (typeof prop === \"symbol\") {\n return undefined;\n }\n\n if (prop === \"getSessionUpdates\") {\n return getSessionUpdates;\n } else if (prop === \"on\") {\n return addEventListener;\n } else if (prop === \"update\") {\n return update;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return table[prop];\n },\n\n set() {\n throw new TypeError(\"SessionTable is readonly\");\n },\n }) as SessionTable;\n};\n"],"names":["columnName","value"],"mappings":";;AAWa,MAAA,YAAA,GAAe,CAAC,KAAA,EAAc,SAAoC,KAAA;AAC7E,EAAM,MAAA,OAAA,uBAAc,GAAwB,EAAA;AAE5C,EAAA,MAAM,oBAAoB,MAAM;AAC9B,IAAO,OAAA,OAAA;AAAA,GACT;AAIA,EAAM,MAAA,gBAAA,GAAmB,CAAC,KAAA,EAAe,OAAqB,KAAA;AAG5D,IAAM,KAAA,CAAA,EAAA,CAAG,OAAO,OAAO,CAAA;AAAA,GACzB;AAEA,EAAA,MAAM,MAAS,GAAA,CACb,GACA,EAAA,UAAA,EACA,KACG,KAAA;AAGH,IAAM,MAAA,GAAA,GAAM,KAAM,CAAA,SAAA,CAAU,GAAG,CAAA;AAC/B,IAAA,IAAI,GAAK,EAAA;AACP,MAAM,MAAA,OAAA,GAAU,MAAM,GAAI,CAAA,mBAAA;AAE1B,MAAI,IAAA,aAAA,GAAgB,OAAQ,CAAA,GAAA,CAAI,GAAG,CAAA;AACnC,MAAA,IAAI,kBAAkB,KAAW,CAAA,EAAA;AAC/B,QAAgB,aAAA,GAAA;AAAA,UACd,mBAAA,EAAqB,IAAI,OAAO,CAAA;AAAA,UAChC,aAAa;AAAC,SAChB;AACA,QAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,aAAa,CAAA;AAAA;AAEhC,MAAc,aAAA,CAAA,WAAA,CAAY,UAAU,CAAI,GAAA,KAAA;AAExC,MAAM,MAAA,MAAA,GAAS,IAAI,KAAM,EAAA;AAEzB,MAAA,KAAA,MAAW,CAACA,WAAAA,EAAYC,MAAK,CAAA,IAAK,MAAO,CAAA,OAAA;AAAA,QACvC,aAAc,CAAA;AAAA,OACb,EAAA;AACD,QAAM,MAAA,QAAA,GAAW,KAAM,CAAA,GAAA,CAAID,WAAU,CAAA;AACrC,QAAA,MAAA,CAAO,QAAQ,CAAIC,GAAAA,MAAAA;AAAA;AAGrB,MAAA,KAAA,CAAM,IAAK,CAAA,QAAA,EAAU,MAAQ,EAAA,UAAA,EAAY,SAAS,CAAA;AAAA,KAC7C,MAAA;AACL,MAAQ,OAAA,CAAA,IAAA,CAAK,CAA2B,wBAAA,EAAA,GAAG,CAAY,UAAA,CAAA,CAAA;AAAA;AACzD,GACF;AAEA,EAAO,OAAA,IAAI,MAAM,KAAO,EAAA;AAAA,IACtB,GAAA,CAAI,MAAM,IAAuB,EAAA;AAC/B,MAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,QAAO,OAAA,KAAA,CAAA;AAAA;AAGT,MAAA,IAAI,SAAS,mBAAqB,EAAA;AAChC,QAAO,OAAA,iBAAA;AAAA,OACT,MAAA,IAAW,SAAS,IAAM,EAAA;AACxB,QAAO,OAAA,gBAAA;AAAA,OACT,MAAA,IAAW,SAAS,QAAU,EAAA;AAC5B,QAAO,OAAA,MAAA;AAAA;AAKT,MAAA,OAAO,MAAM,IAAI,CAAA;AAAA,KACnB;AAAA,IAEA,GAAM,GAAA;AACJ,MAAM,MAAA,IAAI,UAAU,0BAA0B,CAAA;AAAA;AAChD,GACD,CAAA;AACH;;;;"}
|
package/esm/SessionTable.js
CHANGED
|
@@ -9,7 +9,6 @@ const SessionTable = (table, sessionId) => {
|
|
|
9
9
|
const update = (key, columnName, value) => {
|
|
10
10
|
const row = table.findByKey(key);
|
|
11
11
|
if (row) {
|
|
12
|
-
const colIndex = table.map[columnName];
|
|
13
12
|
const tsIndex = table.map.vuuUpdatedTimestamp;
|
|
14
13
|
let updatesForRow = updates.get(key);
|
|
15
14
|
if (updatesForRow === void 0) {
|
|
@@ -21,7 +20,12 @@ const SessionTable = (table, sessionId) => {
|
|
|
21
20
|
}
|
|
22
21
|
updatesForRow.cellUpdates[columnName] = value;
|
|
23
22
|
const newRow = row.slice();
|
|
24
|
-
|
|
23
|
+
for (const [columnName2, value2] of Object.entries(
|
|
24
|
+
updatesForRow.cellUpdates
|
|
25
|
+
)) {
|
|
26
|
+
const colIndex = table.map[columnName2];
|
|
27
|
+
newRow[colIndex] = value2;
|
|
28
|
+
}
|
|
25
29
|
table.emit("update", newRow, columnName, sessionId);
|
|
26
30
|
} else {
|
|
27
31
|
console.warn(`SessionTable update row ${key} not found`);
|
package/esm/SessionTable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionTable.js","sources":["../../../packages/vuu-data-test/src/SessionTable.ts"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { Table } from \"./Table\";\n\ntype RowUpdates = {\n cellUpdates: Record<string, VuuRowDataItemType>;\n lastUpdateTimestamp?: number;\n};\n\nexport type SessionTable = Table & {\n getSessionUpdates: () => Map<string, RowUpdates>;\n};\nexport const SessionTable = (table: Table, sessionId: string): SessionTable => {\n const updates = new Map<string, RowUpdates>();\n\n const getSessionUpdates = () => {\n return updates;\n };\n\n // we need to intercept this as addEventListener accesses a private\n // member, so has to be invoked by table itself.\n const addEventListener = (event: string, handler: unknown) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n table.on(event, handler);\n };\n\n const update = (\n key: string,\n columnName: string,\n value: VuuRowDataItemType,\n ) => {\n // we don't actually apply the update to the table, but we emit the updated event, so the bound\n // dataSource will update its own cache\n const row = table.findByKey(key);\n if (row) {\n const
|
|
1
|
+
{"version":3,"file":"SessionTable.js","sources":["../../../packages/vuu-data-test/src/SessionTable.ts"],"sourcesContent":["import { VuuRowDataItemType } from \"@vuu-ui/vuu-protocol-types\";\nimport { Table } from \"./Table\";\n\ntype RowUpdates = {\n cellUpdates: Record<string, VuuRowDataItemType>;\n lastUpdateTimestamp?: number;\n};\n\nexport type SessionTable = Table & {\n getSessionUpdates: () => Map<string, RowUpdates>;\n};\nexport const SessionTable = (table: Table, sessionId: string): SessionTable => {\n const updates = new Map<string, RowUpdates>();\n\n const getSessionUpdates = () => {\n return updates;\n };\n\n // we need to intercept this as addEventListener accesses a private\n // member, so has to be invoked by table itself.\n const addEventListener = (event: string, handler: unknown) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n table.on(event, handler);\n };\n\n const update = (\n key: string,\n columnName: string,\n value: VuuRowDataItemType,\n ) => {\n // we don't actually apply the update to the table, but we emit the updated event, so the bound\n // dataSource will update its own cache\n const row = table.findByKey(key);\n if (row) {\n const tsIndex = table.map.vuuUpdatedTimestamp;\n\n let updatesForRow = updates.get(key);\n if (updatesForRow === undefined) {\n updatesForRow = {\n lastUpdateTimestamp: row[tsIndex] as number | undefined,\n cellUpdates: {},\n };\n updates.set(key, updatesForRow);\n }\n updatesForRow.cellUpdates[columnName] = value;\n\n const newRow = row.slice();\n\n for (const [columnName, value] of Object.entries(\n updatesForRow.cellUpdates,\n )) {\n const colIndex = table.map[columnName];\n newRow[colIndex] = value;\n }\n\n table.emit(\"update\", newRow, columnName, sessionId);\n } else {\n console.warn(`SessionTable update row ${key} not found`);\n }\n };\n\n return new Proxy(table, {\n get(_obj, prop: string | symbol) {\n if (typeof prop === \"symbol\") {\n return undefined;\n }\n\n if (prop === \"getSessionUpdates\") {\n return getSessionUpdates;\n } else if (prop === \"on\") {\n return addEventListener;\n } else if (prop === \"update\") {\n return update;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return table[prop];\n },\n\n set() {\n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AA,KAAA,CAAM,IAAK,CAAA,QAAA,EAAU,MAAQ,EAAA,UAAA,EAAY,SAAS,CAAA;AAAA,KAC7C,MAAA;AACL,MAAQ,OAAA,CAAA,IAAA,CAAK,CAA2B,wBAAA,EAAA,GAAG,CAAY,UAAA,CAAA,CAAA;AAAA;AACzD,GACF;AAEA,EAAO,OAAA,IAAI,MAAM,KAAO,EAAA;AAAA,IACtB,GAAA,CAAI,MAAM,IAAuB,EAAA;AAC/B,MAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,QAAO,OAAA,KAAA,CAAA;AAAA;AAGT,MAAA,IAAI,SAAS,mBAAqB,EAAA;AAChC,QAAO,OAAA,iBAAA;AAAA,OACT,MAAA,IAAW,SAAS,IAAM,EAAA;AACxB,QAAO,OAAA,gBAAA;AAAA,OACT,MAAA,IAAW,SAAS,QAAU,EAAA;AAC5B,QAAO,OAAA,MAAA;AAAA;AAKT,MAAA,OAAO,MAAM,IAAI,CAAA;AAAA,KACnB;AAAA,IAEA,GAAM,GAAA;AACJ,MAAM,MAAA,IAAI,UAAU,0BAA0B,CAAA;AAAA;AAChD,GACD,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.0-alpha.
|
|
2
|
+
"version": "2.1.0-alpha.5",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-local": "2.1.0-alpha.
|
|
7
|
-
"@vuu-ui/vuu-utils": "2.1.0-alpha.
|
|
6
|
+
"@vuu-ui/vuu-data-local": "2.1.0-alpha.5",
|
|
7
|
+
"@vuu-ui/vuu-utils": "2.1.0-alpha.5"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@vuu-ui/vuu-protocol-types": "2.1.0-alpha.
|
|
11
|
-
"@vuu-ui/vuu-data-types": "2.1.0-alpha.
|
|
12
|
-
"@vuu-ui/vuu-table-types": "2.1.0-alpha.
|
|
10
|
+
"@vuu-ui/vuu-protocol-types": "2.1.0-alpha.5",
|
|
11
|
+
"@vuu-ui/vuu-data-types": "2.1.0-alpha.5",
|
|
12
|
+
"@vuu-ui/vuu-table-types": "2.1.0-alpha.5"
|
|
13
13
|
},
|
|
14
14
|
"sideEffects": false,
|
|
15
15
|
"files": [
|