Core
Install Angular Auxiliary Library.
WpxService
Weplanx Assisted Management Services
Public
assets
string
Assets loading address, default/assets
upload
AsyncSubject<UploadOption>
Upload configuration statusscripts
Map<string, AsyncSubject<void>>
Script loading status
Set Assets
setAssets(v: string): void
v
string
Local or remote path
For example: the assets path is the address https://cdn.xxx.com of CDN distribution, add in app.component.ts
Set Upload
setUpload(v: UploadOption): void
v
UploadOption
Upload configurationUploadOption
type
string
platformurl
string
urllimit
number
Upload size limit
Just get it from the backend
Create Model
setModel<T>(key: string, api: WpxApi<T>): WpxModel<T>
key
string
Index, which automatically associates IndexedDBapi
WpxApi<T>
Common API
Initialize a WpxModel
Set Locale
setLocale(id: string): void
id
string
identificationzh-Hans
Simplified Chineseen-US
American English
Load Script
loadScript(key: string, url: string, plugins: string[]): void
key
string
script identityurl
string
script urlplugins
string[]
plugins url of script
Example: import external UMD script
Get Values
getValues(keys?: string[]): Observable<R>
keys
string[]
configuration keys
Update Values
setValues(update: R): Observable<R>
update
R
Update data
Delete Values
deleteValue(key: string): Observable<R>
key
string
configuration key
Transaction
transaction(): Observable<TransactionResult>
Commit Transaction
commit(txn: string): Observable<void>
txn
string
Transaction ID
Get COS Pre-signed
cosPresigned(): Observable<R>
Get COS Picture Info
cosImageInfo(url: string): Observable<WpxImageInfo>
url
string
Image object
WpxStoreService
Local storage based on IndexedDB
Set
set<T>(key: string, value: T): Observable<void>
Get
get<T>(key: string): Observable<T | undefined>
Remove
remove(key: string): Observable<void>
Clear
clear(): Observable<R>
WpxApi<T>
Universal API abstract class
Create
create(doc: T, options?: CreateOption<T>): Observable<R>
doc
T
dataoptions
CreateOption<T>
xdata
XData
doc format conversiontxn
string
transaction ID
BulkCreate
bulkCreate(docs: T[], options?: CreateOption<T>): Observable<R>
docs
T[]
array dataoptions
CreateOption<T>
xdata
XData
docs.$ format conversiontxn
string
transaction ID
Size
size(filter: Filter<T>, options?: FilterOption<T>): Observable<number>
filter
Filter<T>
options
FilterOption<T>
xfilter
XFilter<T>
filter format conversion
Exists
exists(filter: Filter<T>, options?: FilterOption<T>): Observable<boolean>
filter
Filter<T>
options
FilterOption<T>
xfilter
XFilter<T>
filter format conversion
Find
find(filter: Filter<T>, options?: FindOption<T>): Observable<FindResult<T>>
filter
Filter<T>
options
FindOption<T>
keys
Array<keyof AnyDto<T>>
projectionsort
Sort<T>
sortpage
number
page indexpagesize
number
page sizexfilter
XFilter<T>
filter format conversion
FindOne
findOne(filter: Filter<T>, options?: FindOneOption<T>): Observable<AnyDto<T>>
filter
Filter<T>
options
FindOneOption<T>
keys
Array<keyof AnyDto<T>>
projectionxfilter
XFilter<T>
filter format conversion
FindById
findById(id: string, options?: FindByIdOption<T>): Observable<AnyDto<T>>
id
string
options
FindByIdOption<T>
keys
Array<keyof AnyDto<T>>
projection
Update
update(filter: Filter<T>, update: Update<T>, options?: UpdateOption<T>): Observable<R>
filter
Filter<T>
update
Update<T>
update dataoptions
UpdateOption<T>
xfilter
XFilter<T>
filter format conversionxdata
XData
update format conversiontxn
string
transaction ID
UpdateById
updateById(id: string, update: Update<T>, options?: UpdateOneByIdOption<T>): Observable<R>
id
string
update
Update<T>
update dataoptions
UpdateOneByIdOption<T>
xdata
XData
update format conversiontxn
string
transaction ID
Replace
replace(id: string, doc: T, options?: ReplaceOption<T>): Observable<R>
id
string
doc
T
dataoptions
ReplaceOption<T>
xdata
XData
update format conversiontxn
string
transaction ID
Delete
delete(id: string, options?: DeleteOption<T>): Observable<R>
id
string
options
DeleteOption<T>
txn
string
transaction ID
BulkDelete
bulkDelete(filter: Filter<T>, options?: BulkDeleteOption<T>): Observable<R>
filter
Filter<T>
options
BulkDeleteOption<T>
xfilter
XFilter<T>
filter format conversiontxn
string
transaction ID
Sort
sort(key: string, values: string[], options?: SortOption<T>): Observable<R>
key
string
Sort fieldvalues
string[]
ID array, array index is sortedoptions
SortOption<T>
txn
string
transaction ID
WpxItems<T>
Universal tuple abstract class
Public
data
T[]
loading
bool
load statesearchText
string
keyword search textchecked
boolean
whether all are selectedindeterminate
boolean
whether to select partselection
Map<string, T>
selected value
Check
setSelection(data: T): void
data
T
Uncheck
removeSelection(id: string): void
id
string
Checked All
setCurrentSelections(checked: boolean): void
checked
boolean
WpxModel<T>
Universal data model abstract class
Public
data
signal<AnyDto<T>[]>
dataFilter
AnyDto<T>[]
not disabled dataloading
signal<boolean>
load statetotal
number
data totalpage
number
model page indexpagesize
number
model page sizeadvanced
signal<NzDrawerRef | null>
search panelsearchText
string
keyword search textkeywords
Any[]
checked
boolean
whether all are selectedindeterminate
boolean
whether to select partselection
Map<string, T>
selected value
Ready
ready(xfilter?: XFilter): Observable<R>
xfilter
XFilter
default filter formatting
Fetch Data
fetch(search?: Filter<T>, sort?: Sort<T>): Observable<FindResult<T>>
search
Filter<T>
custom filtersort
Sort<T>
custom sort
Check
setSelection(data: T): void
data
T
Uncheck
removeSelection(id: string): void
id
string
Checked All
setCurrentSelections(checked: boolean): void
checked
boolean
Last updated