mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-16 09:48:20 +01:00
gridview: allow to update row data
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
This commit is contained in:
parent
d1f953caf7
commit
89b95b8a37
17
d.ts/antos.d.ts
vendored
17
d.ts/antos.d.ts
vendored
@ -1482,6 +1482,23 @@ interface String {
|
|||||||
*/
|
*/
|
||||||
trimBy(arg: string): string;
|
trimBy(arg: string): string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Extend the Array prototype with some API
|
||||||
|
* functions used by AntOS API
|
||||||
|
*
|
||||||
|
* @interface Array
|
||||||
|
* @template T
|
||||||
|
*/
|
||||||
|
interface Array<T> {
|
||||||
|
/**
|
||||||
|
* Check if the array includes an element
|
||||||
|
*
|
||||||
|
* @param {T} element to check
|
||||||
|
* @returns {boolean}
|
||||||
|
* @memberof Array
|
||||||
|
*/
|
||||||
|
includes(element: T): boolean;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Extend the Data prototype with the
|
* Extend the Data prototype with the
|
||||||
* [[timestamp]] function
|
* [[timestamp]] function
|
||||||
|
@ -157,6 +157,25 @@ interface String {
|
|||||||
trimBy(arg: string): string;
|
trimBy(arg: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the Array prototype with some API
|
||||||
|
* functions used by AntOS API
|
||||||
|
*
|
||||||
|
* @interface Array
|
||||||
|
* @template T
|
||||||
|
*/
|
||||||
|
interface Array<T> {
|
||||||
|
/**
|
||||||
|
* Check if the array includes an element
|
||||||
|
*
|
||||||
|
* @param {T} element to check
|
||||||
|
* @returns {boolean}
|
||||||
|
* @memberof Array
|
||||||
|
*/
|
||||||
|
includes(element: T): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the Data prototype with the
|
* Extend the Data prototype with the
|
||||||
* [[timestamp]] function
|
* [[timestamp]] function
|
||||||
@ -505,10 +524,8 @@ namespace OS {
|
|||||||
*
|
*
|
||||||
* @memberof Version
|
* @memberof Version
|
||||||
*/
|
*/
|
||||||
set version_string(v: string)
|
set version_string(v: string) {
|
||||||
{
|
if (!v) {
|
||||||
if(!v)
|
|
||||||
{
|
|
||||||
this.string = undefined;
|
this.string = undefined;
|
||||||
this.major = undefined;
|
this.major = undefined;
|
||||||
this.minor = undefined;
|
this.minor = undefined;
|
||||||
@ -526,8 +543,7 @@ namespace OS {
|
|||||||
this.branch = 3;
|
this.branch = 3;
|
||||||
if (arr.length >= 2 && br[arr[1]]) {
|
if (arr.length >= 2 && br[arr[1]]) {
|
||||||
this.branch = br[arr[1]];
|
this.branch = br[arr[1]];
|
||||||
if(arr[2])
|
if (arr[2]) {
|
||||||
{
|
|
||||||
this.build_id = arr[2];
|
this.build_id = arr[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -551,8 +567,7 @@ namespace OS {
|
|||||||
this.patch = Number(mt[2]);
|
this.patch = Number(mt[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get version_string(): string
|
get version_string(): string {
|
||||||
{
|
|
||||||
return this.string;
|
return this.string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1268,8 +1283,8 @@ namespace OS {
|
|||||||
//insert a temporal file selector
|
//insert a temporal file selector
|
||||||
const o =
|
const o =
|
||||||
$("<input>")
|
$("<input>")
|
||||||
.attr("type","file")
|
.attr("type", "file")
|
||||||
.attr("multiple","true");
|
.attr("multiple", "true");
|
||||||
o.on("change", function () {
|
o.on("change", function () {
|
||||||
const files = (o[0] as HTMLInputElement).files;
|
const files = (o[0] as HTMLInputElement).files;
|
||||||
const n_files = files.length;
|
const n_files = files.length;
|
||||||
@ -1332,7 +1347,7 @@ namespace OS {
|
|||||||
* @param {string} p message string
|
* @param {string} p message string
|
||||||
*/
|
*/
|
||||||
export function loading(q: number, p: string): void {
|
export function loading(q: number, p: string): void {
|
||||||
const data:API.AnnouncementDataType<number> = {} as API.AnnouncementDataType<number>;
|
const data: API.AnnouncementDataType<number> = {} as API.AnnouncementDataType<number>;
|
||||||
data.id = q;
|
data.id = q;
|
||||||
data.message = p;
|
data.message = p;
|
||||||
data.name = p;
|
data.name = p;
|
||||||
@ -1352,7 +1367,7 @@ namespace OS {
|
|||||||
* @param {string} m message status (`OK` of `FAIL`)
|
* @param {string} m message status (`OK` of `FAIL`)
|
||||||
*/
|
*/
|
||||||
export function loaded(q: number, p: string, m: string): void {
|
export function loaded(q: number, p: string, m: string): void {
|
||||||
const data:API.AnnouncementDataType<boolean> = {} as API.AnnouncementDataType<boolean>;
|
const data: API.AnnouncementDataType<boolean> = {} as API.AnnouncementDataType<boolean>;
|
||||||
data.id = q;
|
data.id = q;
|
||||||
data.message = p;
|
data.message = p;
|
||||||
data.name = "OS";
|
data.name = "OS";
|
||||||
@ -1445,7 +1460,7 @@ namespace OS {
|
|||||||
* @returns {Promise<void>} a promise on the result data
|
* @returns {Promise<void>} a promise on the result data
|
||||||
*/
|
*/
|
||||||
export function requires(l: string, force: boolean = false): Promise<void> {
|
export function requires(l: string, force: boolean = false): Promise<void> {
|
||||||
return new Promise(async (resolve, reject) =>{
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
if (!API.shared[l] || force) {
|
if (!API.shared[l] || force) {
|
||||||
const libfp = l.asFileHandle();
|
const libfp = l.asFileHandle();
|
||||||
|
@ -101,6 +101,10 @@ namespace OS {
|
|||||||
{
|
{
|
||||||
this.attach(v);
|
this.attach(v);
|
||||||
}
|
}
|
||||||
|
for (let celi = 0; celi < this.children.length; celi++) {
|
||||||
|
const cel = (this.children[celi] as GridCellPrototype);
|
||||||
|
cel.data = v[celi];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
get data(): GenericObject<any>[] {
|
get data(): GenericObject<any>[] {
|
||||||
return this._data;
|
return this._data;
|
||||||
@ -785,10 +789,6 @@ namespace OS {
|
|||||||
for (let i = 0; i < nmin; i++) {
|
for (let i = 0; i < nmin; i++) {
|
||||||
const rowel = (this.refs.grid.children[i] as GridRowTag);
|
const rowel = (this.refs.grid.children[i] as GridRowTag);
|
||||||
rowel.data = rows[i];
|
rowel.data = rows[i];
|
||||||
for (let celi = 0; celi < rowel.children.length; celi++) {
|
|
||||||
const cel = (rowel.children[celi] as GridCellPrototype);
|
|
||||||
cel.data = rows[i][celi];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// remove existing remaining rows
|
// remove existing remaining rows
|
||||||
if (ndrows < ncrows) {
|
if (ndrows < ncrows) {
|
||||||
@ -930,20 +930,19 @@ namespace OS {
|
|||||||
|
|
||||||
const el = rowel[0] as GridRowTag;
|
const el = rowel[0] as GridRowTag;
|
||||||
rowel[0].uify(this.observable);
|
rowel[0].uify(this.observable);
|
||||||
el.data = row;
|
|
||||||
|
|
||||||
for (let cell of row) {
|
for (let cell of row) {
|
||||||
let tag = this.cellitem;
|
let tag = this.cellitem;
|
||||||
if (cell.tag) {
|
if (cell.tag) {
|
||||||
({ tag } = cell);
|
tag = cell.tag;
|
||||||
}
|
}
|
||||||
const el = $(`<${tag}>`).appendTo(rowel);
|
const el = $(`<${tag}>`).appendTo(rowel);
|
||||||
const element = el[0] as GridCellPrototype;
|
const element = el[0] as GridCellPrototype;
|
||||||
element.uify(this.observable);
|
element.uify(this.observable);
|
||||||
element.oncellselect = (e) => this.cellselect(e, false);
|
element.oncellselect = (e) => this.cellselect(e, false);
|
||||||
element.oncelldbclick = (e) => this.cellselect(e, true);
|
element.oncelldbclick = (e) => this.cellselect(e, true);
|
||||||
element.data = cell;
|
|
||||||
}
|
}
|
||||||
|
el.data = row;
|
||||||
el.onrowselect = (e) => this.rowselect({
|
el.onrowselect = (e) => this.rowselect({
|
||||||
id: el.aid,
|
id: el.aid,
|
||||||
data: { item: el }
|
data: { item: el }
|
||||||
|
Loading…
Reference in New Issue
Block a user