From 93e5461cea7f44a14bd3612764830ec5d61598f4 Mon Sep 17 00:00:00 2001 From: mabdi Date: Fri, 21 Aug 2020 18:19:34 +0200 Subject: [PATCH 01/19] new test methods for MDLCalendarTest --- .../MDLCalendarTest.class.st | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Material-Design-Lite-Widgets-Tests/MDLCalendarTest.class.st b/src/Material-Design-Lite-Widgets-Tests/MDLCalendarTest.class.st index dd11aacf..1729d95e 100644 --- a/src/Material-Design-Lite-Widgets-Tests/MDLCalendarTest.class.st +++ b/src/Material-Design-Lite-Widgets-Tests/MDLCalendarTest.class.st @@ -100,6 +100,14 @@ MDLCalendarTest >> testSelectNextMonth [ self assert: calendar currentDate equals: (Date year: 2016 month: 5 day: 10) ] +{ #category : #tests } +MDLCalendarTest >> testSelectNextYears [ + calendar currentDate: (Date year: 2016 month: 4 day: 10). + calendar selectNextYears. + self assert: calendar yearsInterval first equals: 2021. + self assert: calendar yearsInterval last equals: 2029 +] + { #category : #tests } MDLCalendarTest >> testSelectPreviousMonth [ calendar currentDate: (Date year: 2016 month: 4 day: 10). @@ -107,3 +115,11 @@ MDLCalendarTest >> testSelectPreviousMonth [ self assert: calendar currentDate asMonth equals: (Month month: 3 year: 2016). self assert: calendar currentDate equals: (Date year: 2016 month: 3 day: 10) ] + +{ #category : #tests } +MDLCalendarTest >> testSelectPreviousYears [ + calendar currentDate: (Date year: 2016 month: 4 day: 10). + calendar selectPreviousYears. + self assert: calendar yearsInterval first equals: 2003. + self assert: calendar yearsInterval last equals: 2011 +] From 15006ec114907be3a91150a3e7dc9b7fab7588e0 Mon Sep 17 00:00:00 2001 From: "yann.lesage" Date: Mon, 1 Mar 2021 14:19:11 +0100 Subject: [PATCH 02/19] feat: add password field --- .../MDLPasswordFieldInput.class.st | 10 ++++++++++ .../WAHtmlCanvas.extension.st | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 src/Material-Design-Lite-Components/MDLPasswordFieldInput.class.st diff --git a/src/Material-Design-Lite-Components/MDLPasswordFieldInput.class.st b/src/Material-Design-Lite-Components/MDLPasswordFieldInput.class.st new file mode 100644 index 00000000..e3b2fcc5 --- /dev/null +++ b/src/Material-Design-Lite-Components/MDLPasswordFieldInput.class.st @@ -0,0 +1,10 @@ +Class { + #name : #MDLPasswordFieldInput, + #superclass : #MDLTextFieldInput, + #category : #'Material-Design-Lite-Components-Forms' +} + +{ #category : #accessing } +MDLPasswordFieldInput >> type [ + ^ 'password' +] diff --git a/src/Material-Design-Lite-Components/WAHtmlCanvas.extension.st b/src/Material-Design-Lite-Components/WAHtmlCanvas.extension.st index 475a81fb..cafa25bb 100644 --- a/src/Material-Design-Lite-Components/WAHtmlCanvas.extension.st +++ b/src/Material-Design-Lite-Components/WAHtmlCanvas.extension.st @@ -957,6 +957,11 @@ WAHtmlCanvas >> mdlNavigationLink: aBlock [ yourself ] +{ #category : #'*Material-Design-Lite-Components' } +WAHtmlCanvas >> mdlPasswordFieldInput [ + ^ self brush: MDLPasswordFieldInput new +] + { #category : #'*Material-Design-Lite-Components' } WAHtmlCanvas >> mdlProgressBar [ ^ self brush: MDLProgressBar new From 0e4481ce0e4a9e1eb8fa3d65662760680e47a28e Mon Sep 17 00:00:00 2001 From: "yann.lesage" Date: Mon, 1 Mar 2021 19:32:15 +0100 Subject: [PATCH 03/19] add demo password field --- .../MDLTextFieldsScreen.class.st | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Material-Design-Lite-Demo/MDLTextFieldsScreen.class.st b/src/Material-Design-Lite-Demo/MDLTextFieldsScreen.class.st index 87b58744..a3ba178e 100644 --- a/src/Material-Design-Lite-Demo/MDLTextFieldsScreen.class.st +++ b/src/Material-Design-Lite-Demo/MDLTextFieldsScreen.class.st @@ -101,6 +101,15 @@ MDLTextFieldsScreen >> renderNumberTextFieldOn: html [ html mdlTextFieldError: 'Input is not a number !' ] ] +{ #category : #demos } +MDLTextFieldsScreen >> renderPasswordTextFieldOn: html [ + html + mdlTextFieldContainer: [ html mdlTextFieldLabel + for: html nextId; + with: 'Password...'. + html mdlPasswordFieldInput id: html lastId ] +] + { #category : #rendering } MDLTextFieldsScreen >> renderScreenContentOn: html [ self @@ -131,5 +140,6 @@ MDLTextFieldsScreen >> specialTextFields [ ^ OrderedDictionary new add: 'Multiple line' -> #renderMultiLineTextFieldOn:; add: 'Expanding' -> #renderExpandingTextFieldOn:; + add: 'Password' -> #renderPasswordTextFieldOn:; yourself ] From 50be7278b8eb2eb4d7c7048e352c90a26648ad49 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 5 Mar 2021 22:32:58 +0100 Subject: [PATCH 04/19] Use defensive strategies to not always build children --- .../MDLNestedList.class.st | 19 ++-------- .../MDLNestedListTreeNode.class.st | 38 ++++++++----------- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/Material-Design-Lite-Widgets/MDLNestedList.class.st b/src/Material-Design-Lite-Widgets/MDLNestedList.class.st index 2f6765d6..2cee0706 100644 --- a/src/Material-Design-Lite-Widgets/MDLNestedList.class.st +++ b/src/Material-Design-Lite-Widgets/MDLNestedList.class.st @@ -64,7 +64,8 @@ Class { 'listStyle', 'onLoadHook', 'listMaxSize', - 'childrenSortBlock' + 'childrenSortBlock', + 'obtainedTreesCache' ], #category : #'Material-Design-Lite-Widgets-List' } @@ -452,20 +453,7 @@ MDLNestedList >> obtainElementForPath: aPath [ { #category : #private } MDLNestedList >> obtainTreeFor: anElement [ - ^ self obtainTreeFor: anElement caches: IdentityDictionary new -] - -{ #category : #private } -MDLNestedList >> obtainTreeFor: anElement caches: obtainedTree [ - ^ obtainedTree - at: anElement - ifAbsentPut: [ | childrenNodes | - childrenNodes := (self childrenBlock value: anElement) collect: [ :aChild | self obtainTreeFor: aChild caches: obtainedTree ]. - MDLNestedListTreeNode - element: anElement - children: childrenNodes - selectedBranch: (childrenNodes anySatisfy: [ :aChild | aChild selectedBranch or: [ aChild selectedElement ] ]) - selectedElement: anElement = self selectedEntity ] + ^ obtainedTreesCache at: anElement ifAbsentPut: [ MDLNestedListTreeNode list: self element: anElement ] ] { #category : #accessing } @@ -566,6 +554,7 @@ MDLNestedList >> renderAnchor: aNode index: anIndex inDiv: div indentedBy: anInt { #category : #rendering } MDLNestedList >> renderContentOn: html [ self ensureId: html. + obtainedTreesCache := IdentityDictionary new. "Reset cache while loading page." html div id: (self idFor: #nestedList); class: #nestedList; diff --git a/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st b/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st index fcc0b9e6..71359c52 100644 --- a/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st +++ b/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st @@ -7,6 +7,7 @@ Class { #name : #MDLNestedListTreeNode, #superclass : #Object, #instVars : [ + 'list', 'element', 'children', 'selectedBranch', @@ -16,23 +17,16 @@ Class { } { #category : #'instance creation' } -MDLNestedListTreeNode class >> element: anElement children: aCollectionOfChildren selectedBranch: aBoolean selectedElement: aBooleanIfSelected [ +MDLNestedListTreeNode class >> list: aNestedList element: anElement [ ^ self new + list: aNestedList; element: anElement; - children: aCollectionOfChildren; - selectedBranch: aBoolean; - selectedElement: aBooleanIfSelected; yourself ] { #category : #accessing } MDLNestedListTreeNode >> children [ - ^ children -] - -{ #category : #accessing } -MDLNestedListTreeNode >> children: anObject [ - children := anObject + ^ children ifNil: [ children := (self list childrenBlock value: self element) collect: [ :aChild | self list obtainTreeFor: aChild ] ] ] { #category : #accessing } @@ -45,6 +39,16 @@ MDLNestedListTreeNode >> element: anObject [ element := anObject ] +{ #category : #accessing } +MDLNestedListTreeNode >> list [ + ^ list +] + +{ #category : #accessing } +MDLNestedListTreeNode >> list: anObject [ + list := anObject +] + { #category : #printing } MDLNestedListTreeNode >> printOn: aStream [ super printOn: aStream. @@ -55,20 +59,10 @@ MDLNestedListTreeNode >> printOn: aStream [ { #category : #accessing } MDLNestedListTreeNode >> selectedBranch [ - ^ selectedBranch -] - -{ #category : #accessing } -MDLNestedListTreeNode >> selectedBranch: anObject [ - selectedBranch := anObject + ^ selectedBranch ifNil: [ selectedBranch := self children anySatisfy: [ :aChild | aChild selectedElement or: [ aChild selectedBranch ] ] ] ] { #category : #accessing } MDLNestedListTreeNode >> selectedElement [ - ^ selectedElement -] - -{ #category : #accessing } -MDLNestedListTreeNode >> selectedElement: anObject [ - selectedElement := anObject + ^ element = self list selectedEntity ] From 8a7f997e76d490ea4ead01bd3fe291945f462383 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 5 Mar 2021 22:35:47 +0100 Subject: [PATCH 05/19] Remove unused variable --- .../MDLNestedListTreeNode.class.st | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st b/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st index 71359c52..b291a0aa 100644 --- a/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st +++ b/src/Material-Design-Lite-Widgets/MDLNestedListTreeNode.class.st @@ -10,8 +10,7 @@ Class { 'list', 'element', 'children', - 'selectedBranch', - 'selectedElement' + 'selectedBranch' ], #category : #'Material-Design-Lite-Widgets-List' } From 385b33e08b536c1d3db210761a07ce99f85930ac Mon Sep 17 00:00:00 2001 From: "yann.lesage" Date: Wed, 29 Sep 2021 15:21:19 +0200 Subject: [PATCH 06/19] improve: 'onComplete:' for ajax script of 'onClickJs:' can be customize by user --- .../MDLNestedListTest.class.st | 15 +++++++ .../MDLNestedList.class.st | 45 ++++++++++++------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/Material-Design-Lite-Widgets-Tests/MDLNestedListTest.class.st b/src/Material-Design-Lite-Widgets-Tests/MDLNestedListTest.class.st index 9cc37090..594b5457 100644 --- a/src/Material-Design-Lite-Widgets-Tests/MDLNestedListTest.class.st +++ b/src/Material-Design-Lite-Widgets-Tests/MDLNestedListTest.class.st @@ -112,6 +112,21 @@ MDLNestedListTest >> testJsOnLoadHook [ self assert: list jsOnLoadHook contents equals: 'console.log("test")' ] +{ #category : #tests } +MDLNestedListTest >> testNotEraseOnCompleOnJSScript [ + WAHtmlCanvas builder + render: [ :html | + list elements: self sampleElements keys. + list + onClickJs: [ :entity | + html jQuery ajax + serializeForm; + onComplete: 'console.log("this exists")' ] ]. + self + assert: [ :html | html render: list ] + generatedIncludes: 'console.log("this exists")' +] + { #category : #tests } MDLNestedListTest >> testRightIconBlockIsRenderedIfNeeded [ list elements: self sampleElements keys. diff --git a/src/Material-Design-Lite-Widgets/MDLNestedList.class.st b/src/Material-Design-Lite-Widgets/MDLNestedList.class.st index 2f6765d6..dddd8c7d 100644 --- a/src/Material-Design-Lite-Widgets/MDLNestedList.class.st +++ b/src/Material-Design-Lite-Widgets/MDLNestedList.class.st @@ -484,6 +484,24 @@ MDLNestedList >> onLoadHook: anObject [ onLoadHook := anObject ] +{ #category : #'as yet unclassified' } +MDLNestedList >> overwriteOnCompleteForNode: aNode inDiv: div index: anIndex indentedBy: anInteger on: html [ + | onClickValue selfOnComplete finalOnComplete | + onClickValue := self actionBlock value: aNode element. + selfOnComplete := (html jQuery id: div) load + html: [ :ajaxHtml | + self + renderItemContentOf: aNode + index: anIndex + indentedBy: anInteger + on: ajaxHtml ]. + [ finalOnComplete := selfOnComplete onComplete: (onClickValue options + at: 'complete' )] + on: GRError do: [ finalOnComplete := selfOnComplete ]. + onClickValue onComplete: finalOnComplete. + ^ onClickValue +] + { #category : #rendering } MDLNestedList >> printHtmlForElementsFrom: start to: end context: aContext on: stream [ self @@ -534,31 +552,24 @@ MDLNestedList >> renderAnchor: aNode index: anIndex inDiv: div indentedBy: anInt | anchor | anchor := html anchor. self actionBlock - ifNotNil: [ - self isJsAction - ifTrue: [ - anchor + ifNotNil: [ self isJsAction + ifTrue: [ anchor onClick: - ((self actionBlock value: aNode element) - onComplete: - ((html jQuery id: div) load - html: [ :ajaxHtml | - self - renderItemContentOf: aNode - index: anIndex - indentedBy: anInteger - on: ajaxHtml ])) ] + (self + overwriteOnCompleteForNode: aNode + inDiv: div + index: anIndex + indentedBy: anInteger + on: html) ] ifFalse: [ anchor callback: [ self actionBlock value: aNode element ] ] ]. anchor - with: [ - html span + with: [ html span class: #item; id: html nextId; with: ((self format value: aNode element) ifEmpty: [ $  ]). self renderHelpOf: aNode element at: html lastId on: html ]. aNode children - ifNotEmpty: [ - html div + ifNotEmpty: [ html div onClick: 'expandCollapse(this)'; class: #icon ] ] From eb64c302772027890fee73bcd7fae9db2360394f Mon Sep 17 00:00:00 2001 From: "yann.lesage" Date: Sat, 2 Oct 2021 09:12:01 +0200 Subject: [PATCH 07/19] fix: on ajax call with js script added by MDL, correct the load of nexts elements --- .../BaselineOfMaterialDesignLite.class.st | 18 ++++++++++-- .../MDLBridge.class.st | 15 ++++++++++ .../MDLLibrary.extension.st | 24 +++++++++++++++ src/Material-Design-Lite-Dev-Tools/package.st | 1 + .../MDLLibrary.class.st | 29 ++++++------------- 5 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 src/Material-Design-Lite-Dev-Tools/MDLBridge.class.st create mode 100644 src/Material-Design-Lite-Dev-Tools/MDLLibrary.extension.st create mode 100644 src/Material-Design-Lite-Dev-Tools/package.st diff --git a/src/BaselineOfMaterialDesignLite/BaselineOfMaterialDesignLite.class.st b/src/BaselineOfMaterialDesignLite/BaselineOfMaterialDesignLite.class.st index db09bc67..c4b8c428 100644 --- a/src/BaselineOfMaterialDesignLite/BaselineOfMaterialDesignLite.class.st +++ b/src/BaselineOfMaterialDesignLite/BaselineOfMaterialDesignLite.class.st @@ -19,7 +19,8 @@ BaselineOfMaterialDesignLite >> baseline: spec [ fileLibraryHelper: spec; materialColors: spec; magritte: spec; - seasideGenerationTester: spec. + seasideGenerationTester: spec; + gitBridge: spec. "Packages" spec @@ -31,9 +32,10 @@ BaselineOfMaterialDesignLite >> baseline: spec [ package: 'Material-Design-Lite-Widgets-Tests' with: [ spec requires: #('Material-Design-Lite-Widgets' 'Material-Design-Lite-Components-Tests') ]; package: 'Material-Design-Lite-Extensions' with: [ spec requires: #('Material-Design-Lite-Utils' 'Material-Design-Lite-Components') ]; package: 'Material-Design-Lite-Extensions-Tests' with: [ spec requires: #('Material-Design-Lite-Extensions' 'Material-Design-Lite-Components-Tests') ]; - package: 'Material-Design-Lite-Utils' with: [ spec requires: #('Seaside3' 'FileLibraryHelper') ]; + package: 'Material-Design-Lite-Utils' with: [ spec requires: #('Seaside3') ]; package: 'Material-Design-Lite-Demo' with: [ spec requires: #('Material-Design-Lite-Core') ]; - package: 'Material-Design-Lite-Magritte' with: [ spec requires: #('Material-Design-Lite-Widgets' 'Material-Design-Lite-Components' 'Magritte') ]. + package: 'Material-Design-Lite-Magritte' with: [ spec requires: #('Material-Design-Lite-Widgets' 'Material-Design-Lite-Components' 'Magritte') ]; + package: 'Material-Design-Lite-Dev-Tools' with: [ spec requires: #('Material-Design-Lite-Magritte' 'FileLibraryHelper' 'GitBridge' ) ]. "Groups" spec @@ -42,6 +44,7 @@ BaselineOfMaterialDesignLite >> baseline: spec [ group: 'core' with: #('Material-Design-Lite-Widgets' 'Material-Design-Lite-Components' 'Material-Design-Lite-Core' 'Material-Design-Lite-Utils'); group: 'default' with: #('core' 'tests' 'demo'); group: 'demo' with: #('Material-Design-Lite-Demo'); + group: 'dev' with: #('all' 'Material-Design-Lite-Dev-Tools'); group: 'magritte' with: #('Material-Design-Lite-Magritte'); group: 'tests' with: #('Material-Design-Lite-Components-Tests' 'Material-Design-Lite-Widgets-Tests' 'Material-Design-Lite-Extensions-Tests' 'Material-Design-Lite-Core-Tests') ] ] @@ -55,6 +58,15 @@ BaselineOfMaterialDesignLite >> fileLibraryHelper: spec [ with: [ spec repository: 'github://jecisc/FileLibraryHelper:v1.x.x/src' ] ] +{ #category : #dependencies } +BaselineOfMaterialDesignLite >> gitBridge: spec [ + "I small project to help developers to manage the files in the FileLibrary." + + spec + baseline: 'GitBridge' + with: [ spec repository: 'github://jecisc/GitBridge:v1.x.x/src' ] +] + { #category : #dependencies } BaselineOfMaterialDesignLite >> magritte: spec [ spec diff --git a/src/Material-Design-Lite-Dev-Tools/MDLBridge.class.st b/src/Material-Design-Lite-Dev-Tools/MDLBridge.class.st new file mode 100644 index 00000000..8ff56a33 --- /dev/null +++ b/src/Material-Design-Lite-Dev-Tools/MDLBridge.class.st @@ -0,0 +1,15 @@ +Class { + #name : #MDLBridge, + #superclass : #GitBridge, + #category : #'Material-Design-Lite-Dev-Tools' +} + +{ #category : #'class initialization' } +MDLBridge class >> initialize [ + SessionManager default registerSystemClassNamed: self name +] + +{ #category : #accessing } +MDLBridge class >> resources [ + ^ self root / 'resources' +] diff --git a/src/Material-Design-Lite-Dev-Tools/MDLLibrary.extension.st b/src/Material-Design-Lite-Dev-Tools/MDLLibrary.extension.st new file mode 100644 index 00000000..530633ea --- /dev/null +++ b/src/Material-Design-Lite-Dev-Tools/MDLLibrary.extension.st @@ -0,0 +1,24 @@ +Extension { #name : #MDLLibrary } + +{ #category : #'*Material-Design-Lite-Dev-Tools' } +MDLLibrary class >> deployFiles [ +