2 <eg-staff-banner bannerText="Sandbox" i18n-bannerText>
6 i18n-prefix i18n-suffix
7 prefix=":) {{dynamicTitleText}}"
10 <eg-help-popover [placement]="'right'" helpText="This page is for random ng stuff!"></eg-help-popover>
11 <div class="row flex pt-2">
12 <div i18n> Modify Page Title: </div>
13 <div class="col-lg-2">
14 <input type="text" [(ngModel)]="dynamicTitleText" class="form-control"/>
18 <!-- FM Editor Experiments ----------------------------- -->
19 <div class="row mb-3">
20 <ng-template #descriptionTemplate
21 let-field="field" let-record="record" let-hello="hello">
22 <!-- example custom template for editing the 'description' field -->
24 placeholder="{{hello}}"
27 [readonly]="field.readOnly"
28 [required]="field.isRequired()"
29 [ngModel]="record[field.name]()"
30 (ngModelChange)="record[field.name]($event)">
33 <!-- note: fieldOptions would be best defined in the .ts file, but
34 want to demostrate it can be set in the template as well -->
35 <eg-fm-record-editor #fmRecordEditor
36 idlClass="cmrcfld" mode="create"
37 [fieldOptions]="{marc_record_type:{customValues:[{id:'biblio'},{id:'serial'},{id:'authority'}]},description:{customTemplate:{template:descriptionTemplate,context:{'hello':'goodbye'}}}}"
38 recordId="1" orgDefaultAllowed="owner">
39 </eg-fm-record-editor>
40 <button class="btn btn-dark" (click)="openEditor()">
44 <!-- / FM Editor Experiments ----------------------------- -->
46 <!-- Progress Dialog Experiments ----------------------------- -->
47 <div class="row mb-3">
48 <div class="col-lg-3">
49 <button class="btn btn-outline-danger" (click)="progress.increment()">Increment Inline</button>
50 <eg-help-popover [placement]="'bottom'" helpText="Exercise your clicking finger by clicking the button above.">
53 <div class="col-lg-3">
54 <eg-progress-inline [max]="100" [value]="1" #progress></eg-progress-inline>
57 <div class="row mb-3">
58 <div class="col-lg-4">
59 <eg-progress-dialog #progressDialog>
61 <button class="btn btn-light" (click)="showProgress()">Test Progress Dialog</button>
63 <div class="col-lg-3">
64 <eg-help-popover helpLink="https://www.youtube.com/watch?v=dQw4w9WgXcQ" helpText="This popover is supposed to help or something...!"></eg-help-popover>
65 <eg-combobox [allowFreeText]="true"
66 placeholder="Combobox with static data"
67 [entries]="cbEntries"></eg-combobox>
69 <div class="col-lg-3">
70 <eg-help-popover helpText="You have to type to see any options in this dropdown."></eg-help-popover>
72 placeholder="Combobox with dynamic data that does not enable click if no search term is supplied"
73 [asyncDataSource]="cbAsyncSource"></eg-combobox>
76 <div class="row mb-3">
77 <div class="col-lg-4">
78 <eg-help-popover helpText="If you like Toast you must click below!" placement="'auto'"></eg-help-popover>
79 <button class="btn btn-info" (click)="testToast()">Test Toast Message</button>
81 <div class="col-lg-2">
82 Org select with limit perms
84 <div class="col-lg-2">
85 <eg-org-select [limitPerms]="['REGISTER_WORKSTATION']">
89 <div class="row mb-3">
90 <div class="col-lg-4">
92 <div class="col-lg-3">
93 <eg-combobox placeholder="Combobox with @idlClass = 'aou' @idlField='shortname'" idlClass="aou" idlField="shortname" [asyncSupportsEmptyTermClick]="true">
96 <div class="col-lg-3">
97 <eg-combobox placeholder="Combobox with @idlClass = 'cvrfm'" idlClass="cvrfm" [asyncSupportsEmptyTermClick]="true">
100 <div class="col-lg-3">
101 <eg-combobox placeholder="Combobox with @idlClass = 'csp'" idlClass="csp" [asyncSupportsEmptyTermClick]="true">
105 <div class="row mb-3">
106 <div class="col-lg-4">
108 <div class="col-lg-3">
109 <eg-combobox placeholder="Combobox with @idlClass = 'aou'" idlClass="aou" [asyncSupportsEmptyTermClick]="true">
112 <div class="col-lg-3">
115 <!-- /Progress Dialog Experiments ----------------------------- -->
119 <div class="row mb-3">
120 <eg-string #helloString text="Hello, {{name}}" i18n-text></eg-string>
121 <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
125 <div class="row mb-3">
126 <ng-template #helloStrTmpl let-name="name" i18n>Hello, {{name}}</ng-template>
128 <eg-string #helloStr key="helloKey" [template]="helloStrTmpl"></eg-string>
130 <eg-string key="staff.sandbox.test" [template]="helloStrTmpl"></eg-string>
131 <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
135 <div class="form-group">
136 <eg-date-select (onChangeAsDate)="changeDate($event)"
137 initialYmd="2017-03-04">
140 <div>HERE: {{testDate}}</div>
145 <button class="btn btn-secondary" (click)="doPrint()">Test Print</button>
146 <ng-template #printTemplate let-context>Hello, {{context.world}}!</ng-template>
148 <button class="btn btn-secondary" (click)="printWithDialog()">Print with dialog</button>
152 <div class="col-lg-3">
153 <eg-translate #translate [idlObject]="oneBtype" fieldName="name"></eg-translate>
154 <button class="btn btn-info"
155 (click)="translate.open({size:'lg'})">Translate</button>
162 <h4>Cross-tab communications example</h4>
163 <p>To test, open this sandbox in a second browser tab. Enter something in the input box below, then switch to the other tab and click anywhere on the page.
164 You should see the message that you sent to the other browser tab.</p>
167 <div class="col-lg-3">
168 <input type="text" #sendSbMessage placeholder="message to send to another tab" size="40" (change)="sendMessage($event)">
170 <div class="col-lg-3">
171 message received: {{sbChannelText}}
177 <ngb-panel title="Open me for comboboxes">
178 <ng-template ngbPanelContent>
179 <eg-org-select></eg-org-select>
181 <eg-combobox-entry entryId="bib" entryLabel="Bibliographic Records"
182 i18n-entryLabel></eg-combobox-entry>
183 <eg-combobox-entry entryId="auth" entryLabel="Authority Records"
184 i18n-entryLabel></eg-combobox-entry>
185 <eg-combobox-entry entryId="bib-acq" entryLabel="Acquisitions Records"
186 i18n-entryLabel></eg-combobox-entry>
193 <ng-template #cellTmpl let-row="row" let-col="col" let-userContext="userContext">
194 HELLO {{userContext.hello}}
195 <button>{{row.id()}}</button>
197 <eg-grid #cbtGrid idlClass="cbt"
198 [dataSource]="btSource"
199 [rowClassCallback]="btGridRowClassCallback"
200 [rowFlairIsEnabled]="true"
201 [rowFlairCallback]="btGridRowFlairCallback"
202 [cellClassCallback]="btGridCellClassCallback"
203 [stickyHeader]="true"
205 <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
206 (onClick)="complimentEvergreen($event)" [disableOnRows]="notOneSelectedRow">
207 </eg-grid-toolbar-action>
208 <eg-grid-toolbar-action [isSeparator]="true">
209 </eg-grid-toolbar-action>
210 <eg-grid-toolbar-action label="Another Action" i18n-label
211 (onClick)="complimentEvergreen2($event)">
212 </eg-grid-toolbar-action>
213 <eg-grid-column name="test" [cellTemplate]="cellTmpl"
214 [cellContext]="btGridTestContext" [sortable]="false">
216 <eg-grid-column [sortable]="false" path="owner.name"></eg-grid-column>
217 <eg-grid-column [sortable]="false" path="datetime_test"
218 datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
225 ngModel #myRange="ngModel"
226 [initialRangeStart]="sevenDaysAgo()"
227 [initialRangeLength]="5"
228 [markDisabled]="allFutureDates">
229 </eg-daterange-select>
230 Your range is: {{myRange.value | json}}
233 <form [formGroup]="myTimeForm">
235 formControlName="datetime">
236 </eg-datetime-select>
237 Your datetime is: {{myTimeForm.get('datetime').value | json}}
243 <h4>Grid with filtering</h4>
244 <eg-grid #acpGrid idlClass="acp"
245 [dataSource]="acpSource"
248 [showLinkSelectors]="true"
249 [stickyHeader]="true"
250 showFields="barcode,location,circ_lib,price,dummy_title,create_date"
252 <eg-grid-toolbar-action label="Edit Selected" i18n-label [action]="editSelected">
253 </eg-grid-toolbar-action>
254 <eg-grid-column [sortable]="true" [filterable]="false" path="barcode"></eg-grid-column>
255 <eg-grid-column [sortable]="true" path="circ_lib"></eg-grid-column>
256 <eg-grid-column [sortable]="true" path="price"></eg-grid-column>
257 <eg-grid-column [sortable]="true" path="dummy_title"></eg-grid-column>
258 <eg-grid-column [sortable]="true" path="create_date"></eg-grid-column>
261 <eg-fm-record-editor #acpEditDialog idlClass="acp" hiddenFields="call_number,creator,create_date,editor,edit_time,loan_duration,fine_level,dummy_author,dummy_isbn,ref,floating,holdable,circ_as_type,active_date,mint_condition,cost,deleted,deposit,deposit_amount,circulate,status_changed_time,copy_number">
262 </eg-fm-record-editor>
263 <eg-string #successString text="Updated succeeded!" i18n-text></eg-string>
264 <eg-string #updateFailedString text="Updated failed!" i18n-text></eg-string>
266 <h4>PCRUD auto flesh and FormatService detection</h4>
267 <div *ngIf="aMetarecord">Fingerprint: {{aMetarecord}}</div>
270 <div class="card col-md-6">
271 <div class="card-body">
272 <h3 class="card-title">Do you like template-driven forms?</h3>
273 <div class="card-text">
274 <eg-org-family-select
275 [ancestorSelectorChecked]="true"
276 [hideDescendantSelector]="true"
278 labelText="Choose the best libraries"
279 ngModel #bestOnes="ngModel">
280 </eg-org-family-select>
281 The best libraries are: {{bestOnes.value | json}}
283 <eg-combobox [(ngModel)]="kingdom" [allowFreeText]="true">
284 <eg-combobox-entry entryId="Bacteria"></eg-combobox-entry>
285 <eg-combobox-entry entryId="Archaea"></eg-combobox-entry>
286 <eg-combobox-entry entryId="Protozoa"></eg-combobox-entry>
287 <eg-combobox-entry entryId="Chromista"></eg-combobox-entry>
288 <eg-combobox-entry entryId="Plantae"></eg-combobox-entry>
289 <eg-combobox-entry entryId="Fungi"></eg-combobox-entry>
290 <eg-combobox-entry entryId="Animalia"></eg-combobox-entry>
292 Result: {{kingdom | json}}
294 <eg-date-select [(ngModel)]="dateObject">
296 ngModel: {{dateObject.toLocaleDateString()}}
300 <form class="card col-md-4" [formGroup]="ranganathan">
301 <div class="card-body">
302 <h3 class="card-title">Or perhaps reactive forms interest you?</h3>
303 <div class="card-text">
304 Choose your favorite law of library science:
305 <eg-combobox formControlName="law" value="second"
306 [allowFreeText]="true" [startIdFiresOnChange]="true">
307 <eg-combobox-entry entryId="first" entryLabel="Books are for use" i18n-entryLabel></eg-combobox-entry>
308 <eg-combobox-entry entryId="second" entryLabel="Every person his or her book" i18n-entryLabel></eg-combobox-entry>
309 <eg-combobox-entry entryId="third" entryLabel="Every book its reader" i18n-entryLabel></eg-combobox-entry>
310 <eg-combobox-entry entryId="fourth" entryLabel="Save the time of the reader" i18n-entryLabel></eg-combobox-entry>
311 <eg-combobox-entry entryId="fifth" entryLabel="Library is a growing organism" i18n-entryLabel></eg-combobox-entry>
312 <eg-combobox-entry entryId="wrong" entryLabel="42" i18n-entryLabel></eg-combobox-entry>
314 <div *ngIf="!ranganathan.valid" class="alert alert-danger">
315 <span class="material-icons">error</span>
316 <span i18n>That isn't a real law of library science!</span>
321 <form class="card col-md-4" [formGroup]="badOrgForm">
322 <div class="card-body">
323 <h3 class="card-title">Another reactive form!</h3>
324 <div class="card-text">
325 <eg-org-family-select
326 formControlName="badOrgSelector"
327 labelText="Choose the fanciest libraries">
328 </eg-org-family-select>
329 <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
330 <span class="material-icons">error</span>
331 <span i18n>Too many fancy libraries!</span>
338 <button (click)="confirmNumber(1)">Confirm 1</button>
339 <button (click)="confirmNumber(0)">Confirm 0</button>
340 <button (click)="confirmNumber(20)">Confirm 20</button>
342 <eg-confirm-dialog #numConfirmDialog
344 dialogTitle="Confirm Number"
345 [dialogBodyTemplate]="confirmMsg">
347 <ng-template #confirmMsg>
348 <span i18n>Are you sure you want to confirm {numThings, plural, =1 {this thing} other {these {{numThings}} things}}?</span>
352 <eg-fm-record-editor #bresvEditor
354 hiddenFields="capture_staff,usr" readonlyFields="cancel_time">
355 </eg-fm-record-editor>
356 <button class="btn btn-info" (click)="bresvEditor.open({})">
361 <div class="row m-3 p-3 border-top border-dark">
362 <div class="col-lg-3">Simple Combobox using [(ngModel)]</div>
363 <div class="col-lg-3">
364 <eg-combobox [(ngModel)]="simpleCombo" [allowFreeText]="true">
366 entryId="abc" entryLabel="ABC" i18n-entryLabel></eg-combobox-entry>
368 entryId="def" entryLabel="DEF" i18n-entryLabel></eg-combobox-entry>
371 <div class="col-lg-3">
372 <span i18n>Combobox Value: {{simpleCombo ? simpleCombo.label : ''}}</span>
376 <div class="mt-4 mb-4">
377 <h4>Inline FM Editor</h4>
379 <div class="col-lg-6">
380 <eg-fm-record-editor displayMode="inline"
381 idlClass="cbt" mode="update" recordId="1" orgDefaultAllowed="owner">
382 </eg-fm-record-editor>